mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 08:33:43 -05:00
perf: move "cli/js/40_testing.js" out of main snapshot (#21212)
Closes https://github.com/denoland/deno/issues/21136 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
parent
7d8f0ae038
commit
89424f8e4a
7 changed files with 1269 additions and 1233 deletions
|
@ -320,8 +320,16 @@ impl DenoSubcommand {
|
||||||
matches!(self, Self::Run(_))
|
matches!(self, Self::Run(_))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_test_or_jupyter(&self) -> bool {
|
// Returns `true` if the subcommand depends on testing infrastructure.
|
||||||
matches!(self, Self::Test(_) | Self::Jupyter(_))
|
pub fn needs_test(&self) -> bool {
|
||||||
|
matches!(
|
||||||
|
self,
|
||||||
|
Self::Test(_)
|
||||||
|
| Self::Jupyter(_)
|
||||||
|
| Self::Repl(_)
|
||||||
|
| Self::Bench(_)
|
||||||
|
| Self::Lsp
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,6 @@ deno_core::extension!(
|
||||||
esm_entry_point = "ext:cli/99_main.js",
|
esm_entry_point = "ext:cli/99_main.js",
|
||||||
esm = [
|
esm = [
|
||||||
dir "js",
|
dir "js",
|
||||||
"40_testing.js",
|
|
||||||
"99_main.js"
|
"99_main.js"
|
||||||
],
|
],
|
||||||
customizer = |ext: &mut deno_core::Extension| {
|
customizer = |ext: &mut deno_core::Extension| {
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
* }, { raw: true });
|
* }, { raw: true });
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
{
|
(() => {
|
||||||
const internals = Deno[Deno.internal];
|
const internals = Deno[Deno.internal];
|
||||||
const core = internals.core;
|
const core = internals.core;
|
||||||
|
|
||||||
|
@ -428,4 +428,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
internals.enableJupyter = enableJupyter;
|
internals.enableJupyter = enableJupyter;
|
||||||
}
|
})();
|
||||||
|
|
2471
cli/js/40_testing.js
2471
cli/js/40_testing.js
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,2 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
import "ext:cli/40_testing.js";
|
|
||||||
import "ext:cli/runtime/js/99_main.js";
|
import "ext:cli/runtime/js/99_main.js";
|
||||||
|
|
|
@ -639,9 +639,13 @@ impl CliMainWorkerFactory {
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
|
|
||||||
if self.shared.subcommand.is_test_or_jupyter() {
|
if self.shared.subcommand.needs_test() {
|
||||||
worker.js_runtime.execute_script_static(
|
worker.js_runtime.execute_script_static(
|
||||||
"40_jupyter.js",
|
"ext:cli/40_testing.js",
|
||||||
|
include_str!("js/40_testing.js"),
|
||||||
|
)?;
|
||||||
|
worker.js_runtime.execute_script_static(
|
||||||
|
"ext:cli/40_jupyter.js",
|
||||||
include_str!("js/40_jupyter.js"),
|
include_str!("js/40_jupyter.js"),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,6 +448,11 @@ const finalDenoNs = {
|
||||||
resources: core.resources,
|
resources: core.resources,
|
||||||
close: core.close,
|
close: core.close,
|
||||||
...denoNs,
|
...denoNs,
|
||||||
|
// Deno.test and Deno.bench are noops here, but kept for compatibility; so
|
||||||
|
// that they don't cause errors when used outside of `deno test`/`deno bench`
|
||||||
|
// contexts.
|
||||||
|
test: () => {},
|
||||||
|
bench: () => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
Loading…
Reference in a new issue