diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-03-08 07:44:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 12:44:54 +0100 |
commit | 72fe9bb47005e720444e65a66e91559287137780 (patch) | |
tree | d529ee7f3b2c33063ba4496f8fd3dfdbac0d1355 /core/runtime.rs | |
parent | d24c6ea27f7dea57e3bc0cda342d6cbe59782f7d (diff) |
refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041)
This commit renames "deno_core::InternalModuleLoader" to
"ExtModuleLoader" and changes the specifiers used by the
modules loaded from this loader to "ext:".
"internal:" scheme was really ambiguous and it's more characters than
"ext:", which should result in slightly smaller snapshot size.
Closes https://github.com/denoland/deno/issues/18020
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index 92e23873a..f751138a9 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -8,7 +8,7 @@ use crate::extensions::OpDecl; use crate::extensions::OpEventLoopFn; use crate::inspector::JsRuntimeInspector; use crate::module_specifier::ModuleSpecifier; -use crate::modules::InternalModuleLoaderCb; +use crate::modules::ExtModuleLoaderCb; use crate::modules::ModuleError; use crate::modules::ModuleId; use crate::modules::ModuleLoadId; @@ -275,7 +275,7 @@ pub struct RuntimeOptions { /// An optional callback that will be called for each module that is loaded /// during snapshotting. This callback can be used to transpile source on the /// fly, during snapshotting, eg. to transpile TypeScript to JavaScript. - pub snapshot_module_load_cb: Option<InternalModuleLoaderCb>, + pub snapshot_module_load_cb: Option<ExtModuleLoaderCb>, /// Isolate creation parameters. pub create_params: Option<v8::CreateParams>, @@ -620,7 +620,7 @@ impl JsRuntime { } } - Rc::new(crate::modules::InternalModuleLoader::new( + Rc::new(crate::modules::ExtModuleLoader::new( options.module_loader, esm_sources, options.snapshot_module_load_cb, @@ -3984,8 +3984,8 @@ assertEquals(1, notify_return_value); ) .unwrap_err(); let error_string = error.to_string(); - // Test that the script specifier is a URL: `internal:<repo-relative path>`. - assert!(error_string.contains("internal:core/01_core.js")); + // Test that the script specifier is a URL: `ext:<repo-relative path>`. + assert!(error_string.contains("ext:core/01_core.js")); } #[test] @@ -5018,8 +5018,8 @@ Deno.core.opAsync("op_async_serialize_object_with_numbers_as_keys", { ) -> Pin<Box<ModuleSourceFuture>> { let source = r#" // This module doesn't really exist, just verifying that we'll get - // an error when specifier starts with "internal:". - import { core } from "internal:core.js"; + // an error when specifier starts with "ext:". + import { core } from "ext:core.js"; "#; async move { @@ -5055,7 +5055,7 @@ Deno.core.opAsync("op_async_serialize_object_with_numbers_as_keys", { .unwrap_err(); assert_eq!( err.to_string(), - "Cannot load internal module from external code" + "Cannot load extension module from external code" ); } } |