0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 17:34:47 -05:00

refactor: rename deno specifiers to internal (#17655)

This commit is contained in:
Leo Kettmeir 2023-02-05 17:49:20 +01:00 committed by GitHub
parent a09296322e
commit 84a96110cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 95 additions and 84 deletions

View file

@ -925,7 +925,7 @@ pub fn get_ts_config_for_emit(
"sourceMap": false, "sourceMap": false,
"strict": true, "strict": true,
"target": "esnext", "target": "esnext",
"tsBuildInfoFile": "deno:///.tsbuildinfo", "tsBuildInfoFile": "internal:///.tsbuildinfo",
"useDefineForClassFields": true, "useDefineForClassFields": true,
// TODO(@kitsonk) remove for Deno 2.0 // TODO(@kitsonk) remove for Deno 2.0
"useUnknownInCatchVariables": false, "useUnknownInCatchVariables": false,

View file

@ -27,7 +27,7 @@ impl FromStr for BarePort {
} }
pub fn validator(host_and_port: &str) -> Result<(), String> { pub fn validator(host_and_port: &str) -> Result<(), String> {
if Url::parse(&format!("deno://{host_and_port}")).is_ok() if Url::parse(&format!("internal://{host_and_port}")).is_ok()
|| host_and_port.parse::<IpAddr>().is_ok() || host_and_port.parse::<IpAddr>().is_ok()
|| host_and_port.parse::<BarePort>().is_ok() || host_and_port.parse::<BarePort>().is_ok()
{ {
@ -43,7 +43,7 @@ pub fn validator(host_and_port: &str) -> Result<(), String> {
pub fn parse(paths: Vec<String>) -> clap::Result<Vec<String>> { pub fn parse(paths: Vec<String>) -> clap::Result<Vec<String>> {
let mut out: Vec<String> = vec![]; let mut out: Vec<String> = vec![];
for host_and_port in paths.iter() { for host_and_port in paths.iter() {
if Url::parse(&format!("deno://{host_and_port}")).is_ok() if Url::parse(&format!("internal://{host_and_port}")).is_ok()
|| host_and_port.parse::<IpAddr>().is_ok() || host_and_port.parse::<IpAddr>().is_ok()
{ {
out.push(host_and_port.to_owned()) out.push(host_and_port.to_owned())

View file

@ -1050,7 +1050,7 @@ impl Inner {
async fn did_close(&mut self, params: DidCloseTextDocumentParams) { async fn did_close(&mut self, params: DidCloseTextDocumentParams) {
let mark = self.performance.mark("did_close", Some(&params)); let mark = self.performance.mark("did_close", Some(&params));
if params.text_document.uri.scheme() == "deno" { if params.text_document.uri.scheme() == "internal" {
// we can ignore virtual text documents closing, as they don't need to // we can ignore virtual text documents closing, as they don't need to
// be tracked in memory, as they are static assets that won't change // be tracked in memory, as they are static assets that won't change
// already managed by the language service // already managed by the language service
@ -2609,7 +2609,7 @@ impl tower_lsp::LanguageServer for LanguageServer {
} }
async fn did_open(&self, params: DidOpenTextDocumentParams) { async fn did_open(&self, params: DidOpenTextDocumentParams) {
if params.text_document.uri.scheme() == "deno" { if params.text_document.uri.scheme() == "internal" {
// we can ignore virtual text documents opening, as they don't need to // we can ignore virtual text documents opening, as they don't need to
// be tracked in memory, as they are static assets that won't change // be tracked in memory, as they are static assets that won't change
// already managed by the language service // already managed by the language service
@ -3121,7 +3121,7 @@ impl Inner {
.performance .performance
.mark("virtual_text_document", Some(&params)); .mark("virtual_text_document", Some(&params));
let specifier = self.url_map.normalize_url(&params.text_document.uri); let specifier = self.url_map.normalize_url(&params.text_document.uri);
let contents = if specifier.as_str() == "deno:/status.md" { let contents = if specifier.as_str() == "internal:/status.md" {
let mut contents = String::new(); let mut contents = String::new();
let mut documents_specifiers = self let mut documents_specifiers = self
.documents .documents

View file

@ -1154,11 +1154,15 @@ impl ImplementationLocation {
language_server: &language_server::Inner, language_server: &language_server::Inner,
) -> lsp::Location { ) -> lsp::Location {
let specifier = normalize_specifier(&self.document_span.file_name) let specifier = normalize_specifier(&self.document_span.file_name)
.unwrap_or_else(|_| ModuleSpecifier::parse("deno://invalid").unwrap()); .unwrap_or_else(|_| {
ModuleSpecifier::parse("internal://invalid").unwrap()
});
let uri = language_server let uri = language_server
.url_map .url_map
.normalize_specifier(&specifier) .normalize_specifier(&specifier)
.unwrap_or_else(|_| ModuleSpecifier::parse("deno://invalid").unwrap()); .unwrap_or_else(|_| {
ModuleSpecifier::parse("internal://invalid").unwrap()
});
lsp::Location { lsp::Location {
uri, uri,
range: self.document_span.text_span.to_range(line_index), range: self.document_span.text_span.to_range(line_index),

View file

@ -17,7 +17,7 @@ use std::sync::Arc;
/// Used in situations where a default URL needs to be used where otherwise a /// Used in situations where a default URL needs to be used where otherwise a
/// panic is undesired. /// panic is undesired.
pub static INVALID_SPECIFIER: Lazy<ModuleSpecifier> = pub static INVALID_SPECIFIER: Lazy<ModuleSpecifier> =
Lazy::new(|| ModuleSpecifier::parse("deno://invalid").unwrap()); Lazy::new(|| ModuleSpecifier::parse("internal://invalid").unwrap());
/// Matches the `encodeURIComponent()` encoding from JavaScript, which matches /// Matches the `encodeURIComponent()` encoding from JavaScript, which matches
/// the component percent encoding set. /// the component percent encoding set.
@ -81,7 +81,7 @@ impl LspUrlMapInner {
} }
/// A bi-directional map of URLs sent to the LSP client and internal module /// A bi-directional map of URLs sent to the LSP client and internal module
/// specifiers. We need to map internal specifiers into `deno:` schema URLs /// specifiers. We need to map internal specifiers into `internal:` schema URLs
/// to allow the Deno language server to manage these as virtual documents. /// to allow the Deno language server to manage these as virtual documents.
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]
pub struct LspUrlMap(Arc<Mutex<LspUrlMapInner>>); pub struct LspUrlMap(Arc<Mutex<LspUrlMapInner>>);
@ -101,7 +101,7 @@ impl LspUrlMap {
specifier.clone() specifier.clone()
} else { } else {
let specifier_str = if specifier.scheme() == "asset" { let specifier_str = if specifier.scheme() == "asset" {
format!("deno:/asset{}", specifier.path()) format!("internal:/asset{}", specifier.path())
} else if specifier.scheme() == "data" { } else if specifier.scheme() == "data" {
let data_url = DataUrl::process(specifier.as_str()) let data_url = DataUrl::process(specifier.as_str())
.map_err(|e| uri_error(format!("{e:?}")))?; .map_err(|e| uri_error(format!("{e:?}")))?;
@ -114,7 +114,7 @@ impl LspUrlMap {
media_type.as_ts_extension() media_type.as_ts_extension()
}; };
format!( format!(
"deno:/{}/data_url{}", "internal:/{}/data_url{}",
hash_data_specifier(specifier), hash_data_specifier(specifier),
extension extension
) )
@ -128,7 +128,7 @@ impl LspUrlMap {
}) })
.collect(); .collect();
path.push_str(&parts.join("/")); path.push_str(&parts.join("/"));
format!("deno:/{path}") format!("internal:/{path}")
}; };
let url = Url::parse(&specifier_str)?; let url = Url::parse(&specifier_str)?;
inner.put(specifier.clone(), url.clone()); inner.put(specifier.clone(), url.clone());
@ -138,7 +138,7 @@ impl LspUrlMap {
} }
} }
/// Normalize URLs from the client, where "virtual" `deno:///` URLs are /// Normalize URLs from the client, where "virtual" `internal:///` URLs are
/// converted into proper module specifiers, as well as handle situations /// converted into proper module specifiers, as well as handle situations
/// where the client encodes a file URL differently than Rust does by default /// where the client encodes a file URL differently than Rust does by default
/// causing issues with string matching of URLs. /// causing issues with string matching of URLs.
@ -178,7 +178,7 @@ mod tests {
.normalize_specifier(&fixture) .normalize_specifier(&fixture)
.expect("could not handle specifier"); .expect("could not handle specifier");
let expected_url = let expected_url =
Url::parse("deno:/https/deno.land/x/pkg%401.0.0/mod.ts").unwrap(); Url::parse("internal:/https/deno.land/x/pkg%401.0.0/mod.ts").unwrap();
assert_eq!(actual_url, expected_url); assert_eq!(actual_url, expected_url);
let actual_specifier = map.normalize_url(&actual_url); let actual_specifier = map.normalize_url(&actual_url);
@ -193,7 +193,7 @@ mod tests {
let actual_url = map let actual_url = map
.normalize_specifier(&fixture) .normalize_specifier(&fixture)
.expect("could not handle specifier"); .expect("could not handle specifier");
let expected_url = Url::parse("deno:/https/cdn.skypack.dev/-/postcss%40v8.2.9-E4SktPp9c0AtxrJHp8iV/dist%3Des2020%2Cmode%3Dtypes/lib/postcss.d.ts").unwrap(); let expected_url = Url::parse("internal:/https/cdn.skypack.dev/-/postcss%40v8.2.9-E4SktPp9c0AtxrJHp8iV/dist%3Des2020%2Cmode%3Dtypes/lib/postcss.d.ts").unwrap();
assert_eq!(actual_url, expected_url); assert_eq!(actual_url, expected_url);
let actual_specifier = map.normalize_url(&actual_url); let actual_specifier = map.normalize_url(&actual_url);
@ -207,7 +207,7 @@ mod tests {
let actual_url = map let actual_url = map
.normalize_specifier(&fixture) .normalize_specifier(&fixture)
.expect("could not handle specifier"); .expect("could not handle specifier");
let expected_url = Url::parse("deno:/c21c7fc382b2b0553dc0864aa81a3acacfb7b3d1285ab5ae76da6abec213fb37/data_url.ts").unwrap(); let expected_url = Url::parse("internal:/c21c7fc382b2b0553dc0864aa81a3acacfb7b3d1285ab5ae76da6abec213fb37/data_url.ts").unwrap();
assert_eq!(actual_url, expected_url); assert_eq!(actual_url, expected_url);
let actual_specifier = map.normalize_url(&actual_url); let actual_specifier = map.normalize_url(&actual_url);

View file

@ -101,7 +101,7 @@ impl NodeResolution {
} }
Some(resolution) => (resolution.into_url(), MediaType::Dts), Some(resolution) => (resolution.into_url(), MediaType::Dts),
None => ( None => (
ModuleSpecifier::parse("deno:///missing_dependency.d.ts").unwrap(), ModuleSpecifier::parse("internal:///missing_dependency.d.ts").unwrap(),
MediaType::Dts, MediaType::Dts,
), ),
} }

View file

@ -1073,7 +1073,7 @@ fn lsp_hover_asset() {
"deno/virtualTextDocument", "deno/virtualTextDocument",
json!({ json!({
"textDocument": { "textDocument": {
"uri": "deno:/asset/lib.deno.shared_globals.d.ts" "uri": "internal:/asset/lib.deno.shared_globals.d.ts"
} }
}), }),
) )
@ -1084,7 +1084,7 @@ fn lsp_hover_asset() {
"textDocument/hover", "textDocument/hover",
json!({ json!({
"textDocument": { "textDocument": {
"uri": "deno:/asset/lib.es2015.symbol.wellknown.d.ts" "uri": "internal:/asset/lib.es2015.symbol.wellknown.d.ts"
}, },
"position": { "position": {
"line": 109, "line": 109,
@ -3103,7 +3103,7 @@ fn lsp_code_lens_non_doc_nav_tree() {
"deno/virtualTextDocument", "deno/virtualTextDocument",
json!({ json!({
"textDocument": { "textDocument": {
"uri": "deno:/asset/lib.deno.shared_globals.d.ts" "uri": "internal:/asset/lib.deno.shared_globals.d.ts"
} }
}), }),
) )
@ -3115,7 +3115,7 @@ fn lsp_code_lens_non_doc_nav_tree() {
"textDocument/codeLens", "textDocument/codeLens",
json!({ json!({
"textDocument": { "textDocument": {
"uri": "deno:/asset/lib.deno.shared_globals.d.ts" "uri": "internal:/asset/lib.deno.shared_globals.d.ts"
} }
}), }),
) )

View file

@ -2,5 +2,5 @@
new Event(); new Event();
^ ^
at [WILDCARD] at [WILDCARD]
at new Event (deno:ext/web/[WILDCARD]) at new Event (internal:ext/web/[WILDCARD])
at [WILDCARD] at [WILDCARD]

View file

@ -1,5 +1,5 @@
error: Uncaught (in promise) TypeError: error sending request for url[WILDCARD] error: Uncaught (in promise) TypeError: error sending request for url[WILDCARD]
await fetch("https://nonexistent.deno.land/"); await fetch("https://nonexistent.deno.land/");
^[WILDCARD] ^[WILDCARD]
at async fetch (deno:[WILDCARD]) at async fetch (internal:[WILDCARD])
at async file:///[WILDCARD]/fetch_async_error_stack.ts:1:1 at async file:///[WILDCARD]/fetch_async_error_stack.ts:1:1

View file

@ -3,4 +3,4 @@ error: Uncaught Error: foo
throw new Error("foo"); throw new Error("foo");
^ ^
at [WILDCARD]/queue_microtask_error.ts:2:9 at [WILDCARD]/queue_microtask_error.ts:2:9
at deno:core/[WILDCARD] at internal:core/[WILDCARD]

View file

@ -7,9 +7,9 @@
colno: 9, colno: 9,
error: Error: foo error: Error: foo
at [WILDCARD]/queue_microtask_error_handled.ts:18:9 at [WILDCARD]/queue_microtask_error_handled.ts:18:9
at deno:core/[WILDCARD] at internal:core/[WILDCARD]
} }
onerror() called Error: foo onerror() called Error: foo
at [WILDCARD]/queue_microtask_error_handled.ts:18:9 at [WILDCARD]/queue_microtask_error_handled.ts:18:9
at deno:core/[WILDCARD] at internal:core/[WILDCARD]
2 2

View file

@ -1,2 +1,2 @@
error: Uncaught (in promise) TypeError: Invalid WebAssembly content type. error: Uncaught (in promise) TypeError: Invalid WebAssembly content type.
at handleWasmStreaming (deno:ext/fetch/26_fetch.js:[WILDCARD]) at handleWasmStreaming (internal:ext/fetch/26_fetch.js:[WILDCARD])

View file

@ -2,7 +2,7 @@ error: Uncaught (in worker "") Error
throw new Error(); throw new Error();
^ ^
at [WILDCARD]/workers/drop_handle_race.js:2:9 at [WILDCARD]/workers/drop_handle_race.js:2:9
at Object.action (deno:ext/web/02_timers.js:[WILDCARD]) at Object.action (internal:ext/web/02_timers.js:[WILDCARD])
at handleTimerMacrotask (deno:ext/web/02_timers.js:[WILDCARD]) at handleTimerMacrotask (internal:ext/web/02_timers.js:[WILDCARD])
error: Uncaught (in promise) Error: Unhandled error in child worker. error: Uncaught (in promise) Error: Unhandled error in child worker.
at Worker.#pollControl (deno:runtime/js/11_workers.js:[WILDCARD]) at Worker.#pollControl (internal:runtime/js/11_workers.js:[WILDCARD])

View file

@ -37,13 +37,13 @@ failing step in failing test ... FAILED ([WILDCARD])
nested failure => ./test/steps/failing_steps.ts:[WILDCARD] nested failure => ./test/steps/failing_steps.ts:[WILDCARD]
error: Error: 1 test step failed. error: Error: 1 test step failed.
at runTest (deno:cli/js/40_testing.js:[WILDCARD]) at runTest (internal:cli/js/40_testing.js:[WILDCARD])
at async runTests (deno:cli/js/40_testing.js:[WILDCARD]) at async runTests (internal:cli/js/40_testing.js:[WILDCARD])
multiple test step failures => ./test/steps/failing_steps.ts:[WILDCARD] multiple test step failures => ./test/steps/failing_steps.ts:[WILDCARD]
error: Error: 2 test steps failed. error: Error: 2 test steps failed.
at runTest (deno:cli/js/40_testing.js:[WILDCARD]) at runTest (internal:cli/js/40_testing.js:[WILDCARD])
at async runTests (deno:cli/js/40_testing.js:[WILDCARD]) at async runTests (internal:cli/js/40_testing.js:[WILDCARD])
failing step in failing test => ./test/steps/failing_steps.ts:[WILDCARD] failing step in failing test => ./test/steps/failing_steps.ts:[WILDCARD]
error: Error: Fail test. error: Error: Fail test.

View file

@ -16,8 +16,8 @@ Deno.test(async function sendAsyncStackTrace() {
assertStringIncludes(s, "opcall_test.ts"); assertStringIncludes(s, "opcall_test.ts");
assertStringIncludes(s, "read"); assertStringIncludes(s, "read");
assert( assert(
!s.includes("deno:core"), !s.includes("internal:core"),
"opcall stack traces should NOT include deno:core internals such as unwrapOpResult", "opcall stack traces should NOT include internal:core internals such as unwrapOpResult",
); );
} }
}); });

View file

@ -594,7 +594,7 @@ fn filter_coverages(
coverages coverages
.into_iter() .into_iter()
.filter(|e| { .filter(|e| {
let is_internal = e.url.starts_with("deno:") let is_internal = e.url.starts_with("internal:")
|| e.url.ends_with("__anonymous__") || e.url.ends_with("__anonymous__")
|| e.url.ends_with("$deno$test.js") || e.url.ends_with("$deno$test.js")
|| e.url.ends_with(".snap"); || e.url.ends_with(".snap");

View file

@ -26,7 +26,7 @@ pub async fn print_docs(
let mut doc_nodes = match doc_flags.source_file { let mut doc_nodes = match doc_flags.source_file {
DocSourceFileFlag::Builtin => { DocSourceFileFlag::Builtin => {
let source_file_specifier = let source_file_specifier =
ModuleSpecifier::parse("deno://lib.deno.d.ts").unwrap(); ModuleSpecifier::parse("internal://lib.deno.d.ts").unwrap();
let content = get_types_declaration_file_text(ps.options.unstable()); let content = get_types_declaration_file_text(ps.options.unstable());
let mut loader = deno_graph::source::MemoryLoader::new( let mut loader = deno_graph::source::MemoryLoader::new(
vec![( vec![(

View file

@ -655,7 +655,8 @@ fn abbreviate_test_error(js_error: &JsError) -> JsError {
// check if there are any stack frames coming from user code // check if there are any stack frames coming from user code
let should_filter = frames.iter().any(|f| { let should_filter = frames.iter().any(|f| {
if let Some(file_name) = &f.file_name { if let Some(file_name) = &f.file_name {
!(file_name.starts_with("[deno:") || file_name.starts_with("deno:")) !(file_name.starts_with("[internal:")
|| file_name.starts_with("internal:"))
} else { } else {
true true
} }
@ -667,7 +668,8 @@ fn abbreviate_test_error(js_error: &JsError) -> JsError {
.rev() .rev()
.skip_while(|f| { .skip_while(|f| {
if let Some(file_name) = &f.file_name { if let Some(file_name) = &f.file_name {
file_name.starts_with("[deno:") || file_name.starts_with("deno:") file_name.starts_with("[internal:")
|| file_name.starts_with("internal:")
} else { } else {
false false
} }

View file

@ -446,7 +446,7 @@ struct EmitArgs {
fn op_emit(state: &mut OpState, args: EmitArgs) -> bool { fn op_emit(state: &mut OpState, args: EmitArgs) -> bool {
let state = state.borrow_mut::<State>(); let state = state.borrow_mut::<State>();
match args.file_name.as_ref() { match args.file_name.as_ref() {
"deno:///.tsbuildinfo" => state.maybe_tsbuildinfo = Some(args.data), "internal:///.tsbuildinfo" => state.maybe_tsbuildinfo = Some(args.data),
_ => { _ => {
if cfg!(debug_assertions) { if cfg!(debug_assertions) {
panic!("Unhandled emit write: {}", args.file_name); panic!("Unhandled emit write: {}", args.file_name);
@ -518,11 +518,11 @@ fn op_load(state: &mut OpState, args: Value) -> Result<Value, AnyError> {
let mut hash: Option<String> = None; let mut hash: Option<String> = None;
let mut media_type = MediaType::Unknown; let mut media_type = MediaType::Unknown;
let graph_data = state.graph_data.read(); let graph_data = state.graph_data.read();
let data = if &v.specifier == "deno:///.tsbuildinfo" { let data = if &v.specifier == "internal:///.tsbuildinfo" {
state.maybe_tsbuildinfo.as_deref().map(Cow::Borrowed) state.maybe_tsbuildinfo.as_deref().map(Cow::Borrowed)
// in certain situations we return a "blank" module to tsc and we need to // in certain situations we return a "blank" module to tsc and we need to
// handle the request for that module here. // handle the request for that module here.
} else if &v.specifier == "deno:///missing_dependency.d.ts" { } else if &v.specifier == "internal:///missing_dependency.d.ts" {
hash = Some("1".to_string()); hash = Some("1".to_string());
media_type = MediaType::Dts; media_type = MediaType::Dts;
Some(Cow::Borrowed("declare const __: any;\nexport = __;\n")) Some(Cow::Borrowed("declare const __: any;\nexport = __;\n"))
@ -726,7 +726,7 @@ fn op_resolve(
(specifier_str, media_type.as_ts_extension().into()) (specifier_str, media_type.as_ts_extension().into())
} }
None => ( None => (
"deno:///missing_dependency.d.ts".to_string(), "internal:///missing_dependency.d.ts".to_string(),
".d.ts".to_string(), ".d.ts".to_string(),
), ),
}; };
@ -983,10 +983,10 @@ mod tests {
"lib": ["deno.window"], "lib": ["deno.window"],
"module": "esnext", "module": "esnext",
"noEmit": true, "noEmit": true,
"outDir": "deno:///", "outDir": "internal:///",
"strict": true, "strict": true,
"target": "esnext", "target": "esnext",
"tsBuildInfoFile": "deno:///.tsbuildinfo", "tsBuildInfoFile": "internal:///.tsbuildinfo",
})); }));
let request = Request { let request = Request {
config, config,
@ -1075,7 +1075,7 @@ mod tests {
&mut state, &mut state,
EmitArgs { EmitArgs {
data: "some file content".to_string(), data: "some file content".to_string(),
file_name: "deno:///.tsbuildinfo".to_string(), file_name: "internal:///.tsbuildinfo".to_string(),
}, },
); );
assert!(actual); assert!(actual);
@ -1146,9 +1146,11 @@ mod tests {
Some("some content".to_string()), Some("some content".to_string()),
) )
.await; .await;
let actual = let actual = op_load::call(
op_load::call(&mut state, json!({ "specifier": "deno:///.tsbuildinfo"})) &mut state,
.expect("should have invoked op"); json!({ "specifier": "internal:///.tsbuildinfo"}),
)
.expect("should have invoked op");
assert_eq!( assert_eq!(
actual, actual,
json!({ json!({
@ -1217,7 +1219,7 @@ mod tests {
.expect("should have not errored"); .expect("should have not errored");
assert_eq!( assert_eq!(
actual, actual,
vec![("deno:///missing_dependency.d.ts".into(), ".d.ts".into())] vec![("internal:///missing_dependency.d.ts".into(), ".d.ts".into())]
); );
} }

View file

@ -272,7 +272,7 @@ impl JsError {
if let (Some(file_name), Some(line_number)) = if let (Some(file_name), Some(line_number)) =
(&frame.file_name, frame.line_number) (&frame.file_name, frame.line_number)
{ {
if !file_name.trim_start_matches('[').starts_with("deno:") { if !file_name.trim_start_matches('[').starts_with("internal:") {
source_line = get_source_line( source_line = get_source_line(
file_name, file_name,
line_number, line_number,
@ -424,7 +424,7 @@ impl JsError {
if let (Some(file_name), Some(line_number)) = if let (Some(file_name), Some(line_number)) =
(&frame.file_name, frame.line_number) (&frame.file_name, frame.line_number)
{ {
if !file_name.trim_start_matches('[').starts_with("deno:") { if !file_name.trim_start_matches('[').starts_with("internal:") {
source_line = get_source_line( source_line = get_source_line(
file_name, file_name,
line_number, line_number,
@ -438,7 +438,7 @@ impl JsError {
} }
} else if let Some(frame) = frames.first() { } else if let Some(frame) = frames.first() {
if let Some(file_name) = &frame.file_name { if let Some(file_name) = &frame.file_name {
if !file_name.trim_start_matches('[').starts_with("deno:") { if !file_name.trim_start_matches('[').starts_with("internal:") {
source_line = msg source_line = msg
.get_source_line(scope) .get_source_line(scope)
.map(|v| v.to_rust_string_lossy(scope)); .map(|v| v.to_rust_string_lossy(scope));

View file

@ -216,7 +216,7 @@ impl ExtensionBuilder {
/// Example: /// Example:
/// ```ignore /// ```ignore
/// include_js_files!( /// include_js_files!(
/// prefix "deno:extensions/hello", /// prefix "internal:extensions/hello",
/// "01_hello.js", /// "01_hello.js",
/// "02_goodbye.js", /// "02_goodbye.js",
/// ) /// )

View file

@ -134,12 +134,12 @@ pub mod _ops {
/// A helper macro that will return a call site in Rust code. Should be /// A helper macro that will return a call site in Rust code. Should be
/// used when executing internal one-line scripts for JsRuntime lifecycle. /// used when executing internal one-line scripts for JsRuntime lifecycle.
/// ///
/// Returns a string in form of: "`[deno:<filename>:<line>:<column>]`" /// Returns a string in form of: "`[internal:<filename>:<line>:<column>]`"
#[macro_export] #[macro_export]
macro_rules! located_script_name { macro_rules! located_script_name {
() => { () => {
format!( format!(
"[deno:{}:{}:{}]", "[internal:{}:{}:{}]",
std::file!(), std::file!(),
std::line!(), std::line!(),
std::column!() std::column!()

View file

@ -21,7 +21,7 @@ use std::rc::Rc;
pub(crate) fn init_builtins() -> Extension { pub(crate) fn init_builtins() -> Extension {
Extension::builder("deno_builtins") Extension::builder("deno_builtins")
.js(include_js_files!( .js(include_js_files!(
prefix "deno:core", prefix "internal:core",
"00_primordials.js", "00_primordials.js",
"01_core.js", "01_core.js",
"02_error.js", "02_error.js",

View file

@ -3887,8 +3887,8 @@ assertEquals(1, notify_return_value);
) )
.unwrap_err(); .unwrap_err();
let error_string = error.to_string(); let error_string = error.to_string();
// Test that the script specifier is a URL: `deno:<repo-relative path>`. // Test that the script specifier is a URL: `internal:<repo-relative path>`.
assert!(error_string.contains("deno:core/01_core.js")); assert!(error_string.contains("internal:core/01_core.js"));
} }
#[test] #[test]

View file

@ -39,7 +39,7 @@ pub fn create_snapshot(create_snapshot_options: CreateSnapshotOptions) {
let display_path_str = display_path.display().to_string(); let display_path_str = display_path.display().to_string();
js_runtime js_runtime
.execute_script( .execute_script(
&("deno:".to_string() + &display_path_str.replace('\\', "/")), &("internal:".to_string() + &display_path_str.replace('\\', "/")),
&std::fs::read_to_string(&file).unwrap(), &std::fs::read_to_string(&file).unwrap(),
) )
.unwrap(); .unwrap();

View file

@ -113,7 +113,7 @@ pub fn init<BC: BroadcastChannel + 'static>(
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_webidl", "deno_web"]) .dependencies(vec!["deno_webidl", "deno_web"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/broadcast_channel", prefix "internal:ext/broadcast_channel",
"01_broadcast_channel.js", "01_broadcast_channel.js",
)) ))
.ops(vec![ .ops(vec![

2
ext/cache/lib.rs vendored
View file

@ -28,7 +28,7 @@ pub fn init<CA: Cache + 'static>(
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_webidl", "deno_web", "deno_url", "deno_fetch"]) .dependencies(vec!["deno_webidl", "deno_web", "deno_url", "deno_fetch"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/cache", prefix "internal:ext/cache",
"01_cache.js", "01_cache.js",
)) ))
.ops(vec![ .ops(vec![

View file

@ -7,7 +7,7 @@ use std::path::PathBuf;
pub fn init() -> Extension { pub fn init() -> Extension {
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/console", prefix "internal:ext/console",
"01_colors.js", "01_colors.js",
"02_console.js", "02_console.js",
)) ))

View file

@ -76,7 +76,7 @@ pub fn init(maybe_seed: Option<u64>) -> Extension {
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_webidl", "deno_web"]) .dependencies(vec!["deno_webidl", "deno_web"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/crypto", prefix "internal:ext/crypto",
"00_crypto.js", "00_crypto.js",
"01_webidl.js", "01_webidl.js",
)) ))

View file

@ -98,7 +98,7 @@ where
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_webidl", "deno_web", "deno_url", "deno_console"]) .dependencies(vec!["deno_webidl", "deno_web", "deno_url", "deno_console"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/fetch", prefix "internal:ext/fetch",
"01_fetch_util.js", "01_fetch_util.js",
"20_headers.js", "20_headers.js",
"21_formdata.js", "21_formdata.js",

View file

@ -85,7 +85,7 @@ pub(crate) struct FfiState {
pub fn init<P: FfiPermissions + 'static>(unstable: bool) -> Extension { pub fn init<P: FfiPermissions + 'static>(unstable: bool) -> Extension {
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/ffi", prefix "internal:ext/ffi",
"00_ffi.js", "00_ffi.js",
)) ))
.ops(vec![ .ops(vec![

View file

@ -1515,7 +1515,7 @@ pub fn init<P: FlashPermissions + 'static>(unstable: bool) -> Extension {
"deno_http", "deno_http",
]) ])
.js(deno_core::include_js_files!( .js(deno_core::include_js_files!(
prefix "deno:ext/flash", prefix "internal:ext/flash",
"01_http.js", "01_http.js",
)) ))
.ops(vec![ .ops(vec![

View file

@ -81,7 +81,7 @@ pub fn init() -> Extension {
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_web", "deno_net", "deno_fetch", "deno_websocket"]) .dependencies(vec!["deno_web", "deno_net", "deno_fetch", "deno_websocket"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/http", prefix "internal:ext/http",
"01_http.js", "01_http.js",
)) ))
.ops(vec![ .ops(vec![

View file

@ -87,7 +87,7 @@ pub fn init<P: NetPermissions + 'static>(
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_web"]) .dependencies(vec!["deno_web"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/net", prefix "internal:ext/net",
"01_net.js", "01_net.js",
"02_tls.js", "02_tls.js",
)) ))

View file

@ -86,7 +86,7 @@ pub fn init<P: NodePermissions + 'static>(
) -> Extension { ) -> Extension {
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/node", prefix "internal:ext/node",
"01_node.js", "01_node.js",
"02_require.js", "02_require.js",
)) ))

View file

@ -21,7 +21,7 @@ pub fn init() -> Extension {
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_webidl"]) .dependencies(vec!["deno_webidl"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/url", prefix "internal:ext/url",
"00_url.js", "00_url.js",
"01_urlpattern.js", "01_urlpattern.js",
)) ))

View file

@ -1462,7 +1462,7 @@
const frame = frames[i]; const frame = frames[i];
if ( if (
typeof frame.fileName == "string" && typeof frame.fileName == "string" &&
!StringPrototypeStartsWith(frame.fileName, "deno:") !StringPrototypeStartsWith(frame.fileName, "internal:")
) { ) {
filename = frame.fileName; filename = frame.fileName;
lineno = frame.lineNumber; lineno = frame.lineNumber;

View file

@ -65,7 +65,7 @@ pub fn init<P: TimersPermission + 'static>(
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_webidl", "deno_console", "deno_url"]) .dependencies(vec!["deno_webidl", "deno_console", "deno_url"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/web", prefix "internal:ext/web",
"00_infra.js", "00_infra.js",
"01_dom_exception.js", "01_dom_exception.js",
"01_mimesniff.js", "01_mimesniff.js",

View file

@ -120,7 +120,7 @@ pub fn init(unstable: bool) -> Extension {
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_webidl", "deno_web"]) .dependencies(vec!["deno_webidl", "deno_web"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/webgpu", prefix "internal:ext/webgpu",
"01_webgpu.js", "01_webgpu.js",
"02_idl_types.js", "02_idl_types.js",
)) ))

View file

@ -16,7 +16,7 @@ pub fn init_surface(unstable: bool) -> Extension {
Extension::builder("deno_webgpu_surface") Extension::builder("deno_webgpu_surface")
.dependencies(vec!["deno_webidl", "deno_web", "deno_webgpu"]) .dependencies(vec!["deno_webidl", "deno_web", "deno_webgpu"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:deno_webgpu", prefix "internal:deno_webgpu",
"03_surface.js", "03_surface.js",
"04_surface_idl_types.js", "04_surface_idl_types.js",
)) ))

View file

@ -7,7 +7,7 @@ use deno_core::Extension;
pub fn init() -> Extension { pub fn init() -> Extension {
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/webidl", prefix "internal:ext/webidl",
"00_webidl.js", "00_webidl.js",
)) ))
.build() .build()

View file

@ -505,7 +505,7 @@ pub fn init<P: WebSocketPermissions + 'static>(
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_url", "deno_webidl"]) .dependencies(vec!["deno_url", "deno_webidl"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/websocket", prefix "internal:ext/websocket",
"01_websocket.js", "01_websocket.js",
"02_websocketstream.js", "02_websocketstream.js",
)) ))

View file

@ -25,7 +25,7 @@ pub fn init(origin_storage_dir: Option<PathBuf>) -> Extension {
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.dependencies(vec!["deno_webidl"]) .dependencies(vec!["deno_webidl"])
.js(include_js_files!( .js(include_js_files!(
prefix "deno:ext/webstorage", prefix "internal:ext/webstorage",
"01_webstorage.js", "01_webstorage.js",
)) ))
.ops(vec![ .ops(vec![

View file

@ -45,7 +45,7 @@ pub fn format_location(frame: &JsStackFrame) -> String {
let _internal = frame let _internal = frame
.file_name .file_name
.as_ref() .as_ref()
.map_or(false, |f| f.starts_with("deno:")); .map_or(false, |f| f.starts_with("internal:"));
if frame.is_native { if frame.is_native {
return cyan("native").to_string(); return cyan("native").to_string();
} }
@ -73,7 +73,7 @@ fn format_frame(frame: &JsStackFrame) -> String {
let _internal = frame let _internal = frame
.file_name .file_name
.as_ref() .as_ref()
.map_or(false, |f| f.starts_with("deno:")); .map_or(false, |f| f.starts_with("internal:"));
let is_method_call = let is_method_call =
!(frame.is_top_level.unwrap_or_default() || frame.is_constructor); !(frame.is_top_level.unwrap_or_default() || frame.is_constructor);
let mut result = String::new(); let mut result = String::new();

View file

@ -98,7 +98,7 @@ impl Serialize for WorkerControlEvent {
let value = match error.downcast_ref::<JsError>() { let value = match error.downcast_ref::<JsError>() {
Some(js_error) => { Some(js_error) => {
let frame = js_error.frames.iter().find(|f| match &f.file_name { let frame = js_error.frames.iter().find(|f| match &f.file_name {
Some(s) => !s.trim_start_matches('[').starts_with("deno:"), Some(s) => !s.trim_start_matches('[').starts_with("internal:"),
None => false, None => false,
}); });
json!({ json!({

View file

@ -85,7 +85,10 @@ async function patchSrcLib() {
await patchFile( await patchFile(
join(TARGET_DIR, "src", "lib.rs"), join(TARGET_DIR, "src", "lib.rs"),
(data) => (data) =>
data.replace(`prefix "deno:deno_webgpu",`, `prefix "deno:ext/webgpu",`), data.replace(
`prefix "internal:deno_webgpu",`,
`prefix "internal:ext/webgpu",`,
),
); );
} }