summaryrefslogtreecommitdiff
path: root/ext/node/polyfill.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-04 22:31:38 -0400
committerGitHub <noreply@github.com>2023-03-05 02:31:38 +0000
commitb40086fd7da3729d1d59b312c89ee57747fc66a9 (patch)
tree991583010635feab13fae77e7c8a35fef0a09095 /ext/node/polyfill.rs
parent01028fcdf4f379a7285cc15079306e3ac31edcc1 (diff)
refactor(core): include_js_files! 'dir' option doesn't change specifiers (#18019)
This commit changes "include_js_files!" macro from "deno_core" in a way that "dir" option doesn't cause specifiers to be rewritten to include it. Example: ``` include_js_files! { dir "js", "hello.js", } ``` The above definition required embedders to use: `import ... from "internal:<ext_name>/js/hello.js"`. But with this change, the "js" directory in which the files are stored is an implementation detail, which for embedders results in: `import ... from "internal:<ext_name>/hello.js"`. The directory the files are stored in, is an implementation detail and in some cases might result in a significant size difference for the snapshot. As an example, in "deno_node" extension, we store the source code in "polyfills" directory; which resulted in each specifier to look like "internal:deno_node/polyfills/<module_name>", but with this change it's "internal:deno_node/<module_name>". Given that "deno_node" has over 100 files, many of them having several import specifiers to the same extension, this change removes 10 characters from each import specifier.
Diffstat (limited to 'ext/node/polyfill.rs')
-rw-r--r--ext/node/polyfill.rs88
1 files changed, 44 insertions, 44 deletions
diff --git a/ext/node/polyfill.rs b/ext/node/polyfill.rs
index 18faa6ea5..59f22606a 100644
--- a/ext/node/polyfill.rs
+++ b/ext/node/polyfill.rs
@@ -21,75 +21,75 @@ pub struct NodeModulePolyfill {
pub static SUPPORTED_BUILTIN_NODE_MODULES: &[NodeModulePolyfill] = &[
NodeModulePolyfill {
name: "assert",
- specifier: "internal:deno_node/polyfills/assert.ts",
+ specifier: "internal:deno_node/assert.ts",
},
NodeModulePolyfill {
name: "assert/strict",
- specifier: "internal:deno_node/polyfills/assert/strict.ts",
+ specifier: "internal:deno_node/assert/strict.ts",
},
NodeModulePolyfill {
name: "async_hooks",
- specifier: "internal:deno_node/polyfills/async_hooks.ts",
+ specifier: "internal:deno_node/async_hooks.ts",
},
NodeModulePolyfill {
name: "buffer",
- specifier: "internal:deno_node/polyfills/buffer.ts",
+ specifier: "internal:deno_node/buffer.ts",
},
NodeModulePolyfill {
name: "child_process",
- specifier: "internal:deno_node/polyfills/child_process.ts",
+ specifier: "internal:deno_node/child_process.ts",
},
NodeModulePolyfill {
name: "cluster",
- specifier: "internal:deno_node/polyfills/cluster.ts",
+ specifier: "internal:deno_node/cluster.ts",
},
NodeModulePolyfill {
name: "console",
- specifier: "internal:deno_node/polyfills/console.ts",
+ specifier: "internal:deno_node/console.ts",
},
NodeModulePolyfill {
name: "constants",
- specifier: "internal:deno_node/polyfills/constants.ts",
+ specifier: "internal:deno_node/constants.ts",
},
NodeModulePolyfill {
name: "crypto",
- specifier: "internal:deno_node/polyfills/crypto.ts",
+ specifier: "internal:deno_node/crypto.ts",
},
NodeModulePolyfill {
name: "dgram",
- specifier: "internal:deno_node/polyfills/dgram.ts",
+ specifier: "internal:deno_node/dgram.ts",
},
NodeModulePolyfill {
name: "dns",
- specifier: "internal:deno_node/polyfills/dns.ts",
+ specifier: "internal:deno_node/dns.ts",
},
NodeModulePolyfill {
name: "dns/promises",
- specifier: "internal:deno_node/polyfills/dns/promises.ts",
+ specifier: "internal:deno_node/dns/promises.ts",
},
NodeModulePolyfill {
name: "domain",
- specifier: "internal:deno_node/polyfills/domain.ts",
+ specifier: "internal:deno_node/domain.ts",
},
NodeModulePolyfill {
name: "events",
- specifier: "internal:deno_node/polyfills/events.ts",
+ specifier: "internal:deno_node/events.ts",
},
NodeModulePolyfill {
name: "fs",
- specifier: "internal:deno_node/polyfills/fs.ts",
+ specifier: "internal:deno_node/fs.ts",
},
NodeModulePolyfill {
name: "fs/promises",
- specifier: "internal:deno_node/polyfills/fs/promises.ts",
+ specifier: "internal:deno_node/fs/promises.ts",
},
NodeModulePolyfill {
name: "http",
- specifier: "internal:deno_node/polyfills/http.ts",
+ specifier: "internal:deno_node/http.ts",
},
NodeModulePolyfill {
name: "https",
- specifier: "internal:deno_node/polyfills/https.ts",
+ specifier: "internal:deno_node/https.ts",
},
NodeModulePolyfill {
name: "module",
@@ -97,106 +97,106 @@ pub static SUPPORTED_BUILTIN_NODE_MODULES: &[NodeModulePolyfill] = &[
},
NodeModulePolyfill {
name: "net",
- specifier: "internal:deno_node/polyfills/net.ts",
+ specifier: "internal:deno_node/net.ts",
},
NodeModulePolyfill {
name: "os",
- specifier: "internal:deno_node/polyfills/os.ts",
+ specifier: "internal:deno_node/os.ts",
},
NodeModulePolyfill {
name: "path",
- specifier: "internal:deno_node/polyfills/path.ts",
+ specifier: "internal:deno_node/path.ts",
},
NodeModulePolyfill {
name: "path/posix",
- specifier: "internal:deno_node/polyfills/path/posix.ts",
+ specifier: "internal:deno_node/path/posix.ts",
},
NodeModulePolyfill {
name: "path/win32",
- specifier: "internal:deno_node/polyfills/path/win32.ts",
+ specifier: "internal:deno_node/path/win32.ts",
},
NodeModulePolyfill {
name: "perf_hooks",
- specifier: "internal:deno_node/polyfills/perf_hooks.ts",
+ specifier: "internal:deno_node/perf_hooks.ts",
},
NodeModulePolyfill {
name: "process",
- specifier: "internal:deno_node/polyfills/process.ts",
+ specifier: "internal:deno_node/process.ts",
},
NodeModulePolyfill {
name: "querystring",
- specifier: "internal:deno_node/polyfills/querystring.ts",
+ specifier: "internal:deno_node/querystring.ts",
},
NodeModulePolyfill {
name: "readline",
- specifier: "internal:deno_node/polyfills/readline.ts",
+ specifier: "internal:deno_node/readline.ts",
},
NodeModulePolyfill {
name: "stream",
- specifier: "internal:deno_node/polyfills/stream.ts",
+ specifier: "internal:deno_node/stream.ts",
},
NodeModulePolyfill {
name: "stream/consumers",
- specifier: "internal:deno_node/polyfills/stream/consumers.mjs",
+ specifier: "internal:deno_node/stream/consumers.mjs",
},
NodeModulePolyfill {
name: "stream/promises",
- specifier: "internal:deno_node/polyfills/stream/promises.mjs",
+ specifier: "internal:deno_node/stream/promises.mjs",
},
NodeModulePolyfill {
name: "stream/web",
- specifier: "internal:deno_node/polyfills/stream/web.ts",
+ specifier: "internal:deno_node/stream/web.ts",
},
NodeModulePolyfill {
name: "string_decoder",
- specifier: "internal:deno_node/polyfills/string_decoder.ts",
+ specifier: "internal:deno_node/string_decoder.ts",
},
NodeModulePolyfill {
name: "sys",
- specifier: "internal:deno_node/polyfills/sys.ts",
+ specifier: "internal:deno_node/sys.ts",
},
NodeModulePolyfill {
name: "timers",
- specifier: "internal:deno_node/polyfills/timers.ts",
+ specifier: "internal:deno_node/timers.ts",
},
NodeModulePolyfill {
name: "timers/promises",
- specifier: "internal:deno_node/polyfills/timers/promises.ts",
+ specifier: "internal:deno_node/timers/promises.ts",
},
NodeModulePolyfill {
name: "tls",
- specifier: "internal:deno_node/polyfills/tls.ts",
+ specifier: "internal:deno_node/tls.ts",
},
NodeModulePolyfill {
name: "tty",
- specifier: "internal:deno_node/polyfills/tty.ts",
+ specifier: "internal:deno_node/tty.ts",
},
NodeModulePolyfill {
name: "url",
- specifier: "internal:deno_node/polyfills/url.ts",
+ specifier: "internal:deno_node/url.ts",
},
NodeModulePolyfill {
name: "util",
- specifier: "internal:deno_node/polyfills/util.ts",
+ specifier: "internal:deno_node/util.ts",
},
NodeModulePolyfill {
name: "util/types",
- specifier: "internal:deno_node/polyfills/util/types.ts",
+ specifier: "internal:deno_node/util/types.ts",
},
NodeModulePolyfill {
name: "v8",
- specifier: "internal:deno_node/polyfills/v8.ts",
+ specifier: "internal:deno_node/v8.ts",
},
NodeModulePolyfill {
name: "vm",
- specifier: "internal:deno_node/polyfills/vm.ts",
+ specifier: "internal:deno_node/vm.ts",
},
NodeModulePolyfill {
name: "worker_threads",
- specifier: "internal:deno_node/polyfills/worker_threads.ts",
+ specifier: "internal:deno_node/worker_threads.ts",
},
NodeModulePolyfill {
name: "zlib",
- specifier: "internal:deno_node/polyfills/zlib.ts",
+ specifier: "internal:deno_node/zlib.ts",
},
];