mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
refactor: don't expose Deno[Deno.internal].core namespace (#18816)
This commit is contained in:
parent
2df6db36c8
commit
14aaa73c02
12 changed files with 95 additions and 61 deletions
|
@ -198,7 +198,7 @@ fn recursive_permissions_pledge() {
|
||||||
let context = TestContext::default();
|
let context = TestContext::default();
|
||||||
let output = context
|
let output = context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("bench bench/recursive_permissions_pledge.js")
|
.args("bench --enable-testing-features-do-not-use bench/recursive_permissions_pledge.js")
|
||||||
.run();
|
.run();
|
||||||
output.assert_exit_code(1);
|
output.assert_exit_code(1);
|
||||||
assert_contains!(
|
assert_contains!(
|
||||||
|
|
|
@ -307,6 +307,7 @@ async fn inspector_break_on_first_line() {
|
||||||
let child = util::deno_cmd()
|
let child = util::deno_cmd()
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg(inspect_flag_with_unique_port("--inspect-brk"))
|
.arg(inspect_flag_with_unique_port("--inspect-brk"))
|
||||||
|
.arg("--enable-testing-features-do-not-use")
|
||||||
.arg(script)
|
.arg(script)
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
.stderr(std::process::Stdio::piped())
|
.stderr(std::process::Stdio::piped())
|
||||||
|
|
|
@ -28,6 +28,7 @@ fn js_unit_tests() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--location=http://js-unit-tests/foo/bar")
|
.arg("--location=http://js-unit-tests/foo/bar")
|
||||||
.arg("--no-prompt")
|
.arg("--no-prompt")
|
||||||
|
.arg("--enable-testing-features-do-not-use")
|
||||||
.arg("-A")
|
.arg("-A")
|
||||||
.arg(util::tests_path().join("unit"))
|
.arg(util::tests_path().join("unit"))
|
||||||
.spawn()
|
.spawn()
|
||||||
|
|
|
@ -118,7 +118,7 @@ itest!(dual_cjs_esm {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(child_process_fork_test {
|
itest!(child_process_fork_test {
|
||||||
args: "run -A --quiet npm/child_process_fork_test/main.ts",
|
args: "run -A --quiet --enable-testing-features-do-not-use npm/child_process_fork_test/main.ts",
|
||||||
output: "npm/child_process_fork_test/main.out",
|
output: "npm/child_process_fork_test/main.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
http_server: true,
|
http_server: true,
|
||||||
|
|
|
@ -213,7 +213,7 @@ itest!(_038_checkjs {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_042_dyn_import_evalcontext {
|
itest!(_042_dyn_import_evalcontext {
|
||||||
args: "run --quiet --allow-read --reload run/042_dyn_import_evalcontext.ts",
|
args: "run --quiet --allow-read --reload --enable-testing-features-do-not-use run/042_dyn_import_evalcontext.ts",
|
||||||
output: "run/042_dyn_import_evalcontext.ts.out",
|
output: "run/042_dyn_import_evalcontext.ts.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1161,25 +1161,25 @@ itest!(exit_error42 {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(set_exit_code_0 {
|
itest!(set_exit_code_0 {
|
||||||
args: "run --no-check --unstable run/set_exit_code_0.ts",
|
args: "run --no-check --unstable --enable-testing-features-do-not-use run/set_exit_code_0.ts",
|
||||||
output_str: Some(""),
|
output_str: Some(""),
|
||||||
exit_code: 0,
|
exit_code: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(set_exit_code_1 {
|
itest!(set_exit_code_1 {
|
||||||
args: "run --no-check --unstable run/set_exit_code_1.ts",
|
args: "run --no-check --unstable --enable-testing-features-do-not-use run/set_exit_code_1.ts",
|
||||||
output_str: Some(""),
|
output_str: Some(""),
|
||||||
exit_code: 42,
|
exit_code: 42,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(set_exit_code_2 {
|
itest!(set_exit_code_2 {
|
||||||
args: "run --no-check --unstable run/set_exit_code_2.ts",
|
args: "run --no-check --unstable --enable-testing-features-do-not-use run/set_exit_code_2.ts",
|
||||||
output_str: Some(""),
|
output_str: Some(""),
|
||||||
exit_code: 42,
|
exit_code: 42,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(op_exit_op_set_exit_code_in_worker {
|
itest!(op_exit_op_set_exit_code_in_worker {
|
||||||
args: "run --no-check --unstable --allow-read run/op_exit_op_set_exit_code_in_worker.ts",
|
args: "run --no-check --unstable --allow-read --enable-testing-features-do-not-use run/op_exit_op_set_exit_code_in_worker.ts",
|
||||||
exit_code: 21,
|
exit_code: 21,
|
||||||
output_str: Some(""),
|
output_str: Some(""),
|
||||||
});
|
});
|
||||||
|
@ -1197,7 +1197,7 @@ itest!(heapstats {
|
||||||
|
|
||||||
itest!(finalization_registry {
|
itest!(finalization_registry {
|
||||||
args:
|
args:
|
||||||
"run --quiet --unstable --v8-flags=--expose-gc run/finalization_registry.js",
|
"run --quiet --unstable --enable-testing-features-do-not-use --v8-flags=--expose-gc run/finalization_registry.js",
|
||||||
output: "run/finalization_registry.js.out",
|
output: "run/finalization_registry.js.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2755,7 +2755,7 @@ itest!(long_data_url_formatting {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(eval_context_throw_dom_exception {
|
itest!(eval_context_throw_dom_exception {
|
||||||
args: "run run/eval_context_throw_dom_exception.js",
|
args: "run --enable-testing-features-do-not-use run/eval_context_throw_dom_exception.js",
|
||||||
output: "run/eval_context_throw_dom_exception.js.out",
|
output: "run/eval_context_throw_dom_exception.js.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3117,115 +3117,115 @@ itest!(fetch_async_error_stack {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_1 {
|
itest!(unstable_ffi_1 {
|
||||||
args: "run run/ffi/unstable_ffi_1.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_1.js",
|
||||||
output: "run/ffi/unstable_ffi_1.js.out",
|
output: "run/ffi/unstable_ffi_1.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_2 {
|
itest!(unstable_ffi_2 {
|
||||||
args: "run run/ffi/unstable_ffi_2.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_2.js",
|
||||||
output: "run/ffi/unstable_ffi_2.js.out",
|
output: "run/ffi/unstable_ffi_2.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_3 {
|
itest!(unstable_ffi_3 {
|
||||||
args: "run run/ffi/unstable_ffi_3.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_3.js",
|
||||||
output: "run/ffi/unstable_ffi_3.js.out",
|
output: "run/ffi/unstable_ffi_3.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_4 {
|
itest!(unstable_ffi_4 {
|
||||||
args: "run run/ffi/unstable_ffi_4.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_4.js",
|
||||||
output: "run/ffi/unstable_ffi_4.js.out",
|
output: "run/ffi/unstable_ffi_4.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_5 {
|
itest!(unstable_ffi_5 {
|
||||||
args: "run run/ffi/unstable_ffi_5.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_5.js",
|
||||||
output: "run/ffi/unstable_ffi_5.js.out",
|
output: "run/ffi/unstable_ffi_5.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_6 {
|
itest!(unstable_ffi_6 {
|
||||||
args: "run run/ffi/unstable_ffi_6.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_6.js",
|
||||||
output: "run/ffi/unstable_ffi_6.js.out",
|
output: "run/ffi/unstable_ffi_6.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_7 {
|
itest!(unstable_ffi_7 {
|
||||||
args: "run run/ffi/unstable_ffi_7.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_7.js",
|
||||||
output: "run/ffi/unstable_ffi_7.js.out",
|
output: "run/ffi/unstable_ffi_7.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_8 {
|
itest!(unstable_ffi_8 {
|
||||||
args: "run run/ffi/unstable_ffi_8.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_8.js",
|
||||||
output: "run/ffi/unstable_ffi_8.js.out",
|
output: "run/ffi/unstable_ffi_8.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_9 {
|
itest!(unstable_ffi_9 {
|
||||||
args: "run run/ffi/unstable_ffi_9.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_9.js",
|
||||||
output: "run/ffi/unstable_ffi_9.js.out",
|
output: "run/ffi/unstable_ffi_9.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_10 {
|
itest!(unstable_ffi_10 {
|
||||||
args: "run run/ffi/unstable_ffi_10.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_10.js",
|
||||||
output: "run/ffi/unstable_ffi_10.js.out",
|
output: "run/ffi/unstable_ffi_10.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_11 {
|
itest!(unstable_ffi_11 {
|
||||||
args: "run run/ffi/unstable_ffi_11.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_11.js",
|
||||||
output: "run/ffi/unstable_ffi_11.js.out",
|
output: "run/ffi/unstable_ffi_11.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_12 {
|
itest!(unstable_ffi_12 {
|
||||||
args: "run run/ffi/unstable_ffi_12.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_12.js",
|
||||||
output: "run/ffi/unstable_ffi_12.js.out",
|
output: "run/ffi/unstable_ffi_12.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_13 {
|
itest!(unstable_ffi_13 {
|
||||||
args: "run run/ffi/unstable_ffi_13.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_13.js",
|
||||||
output: "run/ffi/unstable_ffi_13.js.out",
|
output: "run/ffi/unstable_ffi_13.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_14 {
|
itest!(unstable_ffi_14 {
|
||||||
args: "run run/ffi/unstable_ffi_14.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_14.js",
|
||||||
output: "run/ffi/unstable_ffi_14.js.out",
|
output: "run/ffi/unstable_ffi_14.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_15 {
|
itest!(unstable_ffi_15 {
|
||||||
args: "run run/ffi/unstable_ffi_15.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_15.js",
|
||||||
output: "run/ffi/unstable_ffi_15.js.out",
|
output: "run/ffi/unstable_ffi_15.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_16 {
|
itest!(unstable_ffi_16 {
|
||||||
args: "run run/ffi/unstable_ffi_16.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_16.js",
|
||||||
output: "run/ffi/unstable_ffi_16.js.out",
|
output: "run/ffi/unstable_ffi_16.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_17 {
|
itest!(unstable_ffi_17 {
|
||||||
args: "run run/ffi/unstable_ffi_17.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_17.js",
|
||||||
output: "run/ffi/unstable_ffi_17.js.out",
|
output: "run/ffi/unstable_ffi_17.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_18 {
|
itest!(unstable_ffi_18 {
|
||||||
args: "run run/ffi/unstable_ffi_18.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_18.js",
|
||||||
output: "run/ffi/unstable_ffi_18.js.out",
|
output: "run/ffi/unstable_ffi_18.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_ffi_19 {
|
itest!(unstable_ffi_19 {
|
||||||
args: "run run/ffi/unstable_ffi_19.js",
|
args: "run --enable-testing-features-do-not-use run/ffi/unstable_ffi_19.js",
|
||||||
output: "run/ffi/unstable_ffi_19.js.out",
|
output: "run/ffi/unstable_ffi_19.js.out",
|
||||||
exit_code: 70,
|
exit_code: 70,
|
||||||
});
|
});
|
||||||
|
@ -3248,7 +3248,7 @@ itest!(event_listener_error_handled {
|
||||||
|
|
||||||
// https://github.com/denoland/deno/pull/14159#issuecomment-1092285446
|
// https://github.com/denoland/deno/pull/14159#issuecomment-1092285446
|
||||||
itest!(event_listener_error_immediate_exit {
|
itest!(event_listener_error_immediate_exit {
|
||||||
args: "run --quiet run/event_listener_error_immediate_exit.ts",
|
args: "run --quiet --enable-testing-features-do-not-use run/event_listener_error_immediate_exit.ts",
|
||||||
output: "run/event_listener_error_immediate_exit.ts.out",
|
output: "run/event_listener_error_immediate_exit.ts.out",
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
});
|
});
|
||||||
|
@ -3256,7 +3256,7 @@ itest!(event_listener_error_immediate_exit {
|
||||||
// https://github.com/denoland/deno/pull/14159#issuecomment-1092285446
|
// https://github.com/denoland/deno/pull/14159#issuecomment-1092285446
|
||||||
itest!(event_listener_error_immediate_exit_worker {
|
itest!(event_listener_error_immediate_exit_worker {
|
||||||
args:
|
args:
|
||||||
"run --quiet --unstable -A run/event_listener_error_immediate_exit_worker.ts",
|
"run --quiet --unstable -A --enable-testing-features-do-not-use run/event_listener_error_immediate_exit_worker.ts",
|
||||||
output: "run/event_listener_error_immediate_exit_worker.ts.out",
|
output: "run/event_listener_error_immediate_exit_worker.ts.out",
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
});
|
});
|
||||||
|
@ -4363,22 +4363,24 @@ fn permission_prompt_strips_ansi_codes_and_control_chars() {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
util::with_pty(&["repl"], |mut console| {
|
util::with_pty(
|
||||||
console.write_line_raw(r#"const boldANSI = "\u001b[1m";"#);
|
&["repl", "--enable-testing-features-do-not-use"],
|
||||||
console.expect("undefined");
|
|mut console| {
|
||||||
console.write_line_raw(r#"const unboldANSI = "\u001b[22m";"#);
|
console.write_line_raw(r#"const boldANSI = "\u001b[1m";"#);
|
||||||
console.expect("undefined");
|
console.expect("undefined");
|
||||||
console.write_line_raw(r#"const prompt = `┌ ⚠️ ${boldANSI}Deno requests run access to "echo"${unboldANSI}\n ├ Requested by \`Deno.Command().output()`"#);
|
console.write_line_raw(r#"const unboldANSI = "\u001b[22m";"#);
|
||||||
console.expect("undefined");
|
console.expect("undefined");
|
||||||
console.write_line_raw(r#"const moveANSIUp = "\u001b[1A";"#);
|
console.write_line_raw(r#"const prompt = `┌ ⚠️ ${boldANSI}Deno requests run access to "echo"${unboldANSI}\n ├ Requested by \`Deno.Command().output()`"#);
|
||||||
console.expect("undefined");
|
console.expect("undefined");
|
||||||
console.write_line_raw(r#"const clearANSI = "\u001b[2K";"#);
|
console.write_line_raw(r#"const moveANSIUp = "\u001b[1A";"#);
|
||||||
console.expect("undefined");
|
console.expect("undefined");
|
||||||
console.write_line_raw(r#"const moveANSIStart = "\u001b[1000D";"#);
|
console.write_line_raw(r#"const clearANSI = "\u001b[2K";"#);
|
||||||
console.expect("undefined");
|
console.expect("undefined");
|
||||||
|
console.write_line_raw(r#"const moveANSIStart = "\u001b[1000D";"#);
|
||||||
|
console.expect("undefined");
|
||||||
|
|
||||||
console.write_line_raw(
|
console.write_line_raw(
|
||||||
r#"Deno[Deno.internal].core.ops.op_spawn_child({
|
r#"Deno[Deno.internal].core.ops.op_spawn_child({
|
||||||
cmd: "cat",
|
cmd: "cat",
|
||||||
args: ["file.txt"],
|
args: ["file.txt"],
|
||||||
clearEnv: false,
|
clearEnv: false,
|
||||||
|
@ -4392,10 +4394,11 @@ fn permission_prompt_strips_ansi_codes_and_control_chars() {
|
||||||
signal: undefined,
|
signal: undefined,
|
||||||
windowsRawArguments: false,
|
windowsRawArguments: false,
|
||||||
}, moveANSIUp + clearANSI + moveANSIStart + prompt)"#,
|
}, moveANSIUp + clearANSI + moveANSIStart + prompt)"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
console.expect(r#"┌ ⚠️ Deno requests run access to "cat""#);
|
console.expect(r#"┌ ⚠️ Deno requests run access to "cat""#);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
itest!(node_builtin_modules_ts {
|
itest!(node_builtin_modules_ts {
|
||||||
|
|
|
@ -216,7 +216,7 @@ itest!(ops_sanitizer_timeout_failure {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(ops_sanitizer_multiple_timeout_tests {
|
itest!(ops_sanitizer_multiple_timeout_tests {
|
||||||
args: "test --trace-ops test/ops_sanitizer_multiple_timeout_tests.ts",
|
args: "test --trace-ops --enable-testing-features-do-not-use test/ops_sanitizer_multiple_timeout_tests.ts",
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
output: "test/ops_sanitizer_multiple_timeout_tests.out",
|
output: "test/ops_sanitizer_multiple_timeout_tests.out",
|
||||||
});
|
});
|
||||||
|
@ -390,7 +390,7 @@ fn recursive_permissions_pledge() {
|
||||||
let context = TestContext::default();
|
let context = TestContext::default();
|
||||||
let output = context
|
let output = context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("test test/recursive_permissions_pledge.js")
|
.args("test --enable-testing-features-do-not-use test/recursive_permissions_pledge.js")
|
||||||
.run();
|
.run();
|
||||||
output.assert_exit_code(1);
|
output.assert_exit_code(1);
|
||||||
assert_contains!(
|
assert_contains!(
|
||||||
|
|
|
@ -954,7 +954,7 @@ pub async fn test_specifier(
|
||||||
if ps.options.trace_ops() {
|
if ps.options.trace_ops() {
|
||||||
worker.js_runtime.execute_script_static(
|
worker.js_runtime.execute_script_static(
|
||||||
located_script_name!(),
|
located_script_name!(),
|
||||||
"Deno[Deno.internal].core.enableOpCallTracing();",
|
"Deno[Deno.internal].enableOpCallTracing();",
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
worker.dispatch_load_event(located_script_name!())?;
|
worker.dispatch_load_event(located_script_name!())?;
|
||||||
|
|
|
@ -453,7 +453,6 @@
|
||||||
BadResourcePrototype,
|
BadResourcePrototype,
|
||||||
Interrupted,
|
Interrupted,
|
||||||
InterruptedPrototype,
|
InterruptedPrototype,
|
||||||
enableOpCallTracing,
|
|
||||||
isOpCallTracingEnabled,
|
isOpCallTracingEnabled,
|
||||||
opCallTraces,
|
opCallTraces,
|
||||||
refOp,
|
refOp,
|
||||||
|
@ -507,8 +506,11 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
ObjectAssign(globalThis.__bootstrap, { core });
|
ObjectAssign(globalThis.__bootstrap, { core });
|
||||||
const internals = {};
|
ObjectAssign(globalThis.__bootstrap, {
|
||||||
ObjectAssign(globalThis.__bootstrap, { internals });
|
internals: {
|
||||||
|
enableOpCallTracing,
|
||||||
|
},
|
||||||
|
});
|
||||||
ObjectAssign(globalThis.Deno, { core });
|
ObjectAssign(globalThis.Deno, { core });
|
||||||
|
|
||||||
// Direct bindings on `globalThis`
|
// Direct bindings on `globalThis`
|
||||||
|
|
|
@ -479,6 +479,26 @@ impl JsRuntime {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Cache bust plain JS (non-ES modules as well)
|
||||||
|
#[cfg(feature = "include_js_files_for_snapshotting")]
|
||||||
|
if snapshot_options != snapshot_util::SnapshotOptions::None {
|
||||||
|
let js_sources = options
|
||||||
|
.extensions
|
||||||
|
.iter()
|
||||||
|
.flat_map(|ext| match ext.get_js_sources() {
|
||||||
|
Some(s) => s.to_owned(),
|
||||||
|
None => vec![],
|
||||||
|
})
|
||||||
|
.collect::<Vec<ExtensionFileSource>>();
|
||||||
|
for source in js_sources {
|
||||||
|
use crate::ExtensionFileSourceCode;
|
||||||
|
if let ExtensionFileSourceCode::LoadedFromFsDuringSnapshot(path) =
|
||||||
|
&source.code
|
||||||
|
{
|
||||||
|
println!("cargo:rerun-if-changed={}", path.display())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rc::new(crate::modules::ExtModuleLoader::new(
|
Rc::new(crate::modules::ExtModuleLoader::new(
|
||||||
options.module_loader,
|
options.module_loader,
|
||||||
|
|
|
@ -391,12 +391,6 @@ function promiseRejectMacrotaskCallback() {
|
||||||
let hasBootstrapped = false;
|
let hasBootstrapped = false;
|
||||||
// Set up global properties shared by main and worker runtime.
|
// Set up global properties shared by main and worker runtime.
|
||||||
ObjectDefineProperties(globalThis, windowOrWorkerGlobalScope);
|
ObjectDefineProperties(globalThis, windowOrWorkerGlobalScope);
|
||||||
// FIXME(bartlomieju): temporarily add whole `Deno.core` to
|
|
||||||
// `Deno[Deno.internal]` namespace. It should be removed and only necessary
|
|
||||||
// methods should be left there.
|
|
||||||
ObjectAssign(internals, {
|
|
||||||
core,
|
|
||||||
});
|
|
||||||
const internalSymbol = Symbol("Deno.internal");
|
const internalSymbol = Symbol("Deno.internal");
|
||||||
const finalDenoNs = {
|
const finalDenoNs = {
|
||||||
internal: internalSymbol,
|
internal: internalSymbol,
|
||||||
|
@ -428,7 +422,7 @@ function bootstrapMainRuntime(runtimeOptions) {
|
||||||
13: v8Version,
|
13: v8Version,
|
||||||
14: userAgent,
|
14: userAgent,
|
||||||
15: inspectFlag,
|
15: inspectFlag,
|
||||||
// 16: enableTestingFeaturesFlag
|
16: enableTestingFeaturesFlag,
|
||||||
} = runtimeOptions;
|
} = runtimeOptions;
|
||||||
|
|
||||||
performance.setTimeOrigin(DateNow());
|
performance.setTimeOrigin(DateNow());
|
||||||
|
@ -503,6 +497,12 @@ function bootstrapMainRuntime(runtimeOptions) {
|
||||||
ObjectAssign(finalDenoNs, denoNsUnstable);
|
ObjectAssign(finalDenoNs, denoNsUnstable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add `Deno[Deno.internal].core` namespace if
|
||||||
|
// `--enable-testing-features-do-not-use` flag is set.
|
||||||
|
if (enableTestingFeaturesFlag) {
|
||||||
|
ObjectAssign(internals, { core });
|
||||||
|
}
|
||||||
|
|
||||||
// Setup `Deno` global - we're actually overriding already existing global
|
// Setup `Deno` global - we're actually overriding already existing global
|
||||||
// `Deno` with `Deno` namespace from "./deno.ts".
|
// `Deno` with `Deno` namespace from "./deno.ts".
|
||||||
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
|
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
|
||||||
|
@ -612,6 +612,11 @@ function bootstrapWorkerRuntime(
|
||||||
noColor: util.readOnly(noColor),
|
noColor: util.readOnly(noColor),
|
||||||
args: util.readOnly(ObjectFreeze(args)),
|
args: util.readOnly(ObjectFreeze(args)),
|
||||||
});
|
});
|
||||||
|
// Add `Deno[Deno.internal].core` namespace if
|
||||||
|
// `--enable-testing-features-do-not-use` flag is set.
|
||||||
|
if (enableTestingFeaturesFlag) {
|
||||||
|
ObjectAssign(internals, { core });
|
||||||
|
}
|
||||||
// Setup `Deno` global - we're actually overriding already
|
// Setup `Deno` global - we're actually overriding already
|
||||||
// existing global `Deno` with `Deno` namespace from "./deno.ts".
|
// existing global `Deno` with `Deno` namespace from "./deno.ts".
|
||||||
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
|
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
|
||||||
|
|
|
@ -12,6 +12,7 @@ if (import.meta.main) {
|
||||||
const { stdout, stderr, code } = await new Deno.Command(Deno.execPath(), {
|
const { stdout, stderr, code } = await new Deno.Command(Deno.execPath(), {
|
||||||
args: [
|
args: [
|
||||||
"run",
|
"run",
|
||||||
|
"--enable-testing-features-do-not-use",
|
||||||
"--allow-read",
|
"--allow-read",
|
||||||
"--allow-run",
|
"--allow-run",
|
||||||
"--allow-ffi",
|
"--allow-ffi",
|
||||||
|
|
|
@ -31,6 +31,7 @@ fn napi_tests() {
|
||||||
.arg("--allow-env")
|
.arg("--allow-env")
|
||||||
.arg("--allow-ffi")
|
.arg("--allow-ffi")
|
||||||
.arg("--allow-run")
|
.arg("--allow-run")
|
||||||
|
.arg("--enable-testing-features-do-not-use")
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.wait_with_output()
|
.wait_with_output()
|
||||||
|
|
Loading…
Reference in a new issue