summaryrefslogtreecommitdiff
path: root/cli/source_maps.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-09-02 17:07:11 -0400
committerGitHub <noreply@github.com>2019-09-02 17:07:11 -0400
commitd43b43ca781b025b9a6a54827ea3ef193972ef24 (patch)
tree84173b6a653802a41c23145dd3b2048d9075e2a4 /cli/source_maps.rs
parent56508f113d9fe61ffcce4cbbb85e3d6961888e1d (diff)
Refactor snapshot build (#2825)
Instead of using core/snapshot_creator.rs, instead two crates are introduced which allow building the snapshot during build.rs. Rollup is removed and replaced with our own bundler. This removes the Node build dependency. Modules in //js now use Deno-style imports with file extensions, rather than Node style extensionless imports. This improves incremental build time when changes are made to //js files by about 40 seconds.
Diffstat (limited to 'cli/source_maps.rs')
-rw-r--r--cli/source_maps.rs26
1 files changed, 8 insertions, 18 deletions
diff --git a/cli/source_maps.rs b/cli/source_maps.rs
index 5a34041c5..b3b8d7e56 100644
--- a/cli/source_maps.rs
+++ b/cli/source_maps.rs
@@ -73,22 +73,12 @@ fn builtin_source_map(_: &str) -> Option<Vec<u8>> {
#[cfg(not(feature = "check-only"))]
fn builtin_source_map(script_name: &str) -> Option<Vec<u8>> {
- match script_name {
- "gen/cli/bundle/main.js" => Some(
- include_bytes!(concat!(
- env!("GN_OUT_DIR"),
- "/gen/cli/bundle/main.js.map"
- ))
- .to_vec(),
- ),
- "gen/cli/bundle/compiler.js" => Some(
- include_bytes!(concat!(
- env!("GN_OUT_DIR"),
- "/gen/cli/bundle/compiler.js.map"
- ))
- .to_vec(),
- ),
- _ => None,
+ if script_name.ends_with("CLI_SNAPSHOT.js") {
+ Some(deno_cli_snapshots::CLI_SNAPSHOT_MAP.to_vec())
+ } else if script_name.ends_with("COMPILER_SNAPSHOT.js") {
+ Some(deno_cli_snapshots::COMPILER_SNAPSHOT_MAP.to_vec())
+ } else {
+ None
}
}
@@ -405,7 +395,7 @@ mod tests {
frames: vec![StackFrame {
line: 11,
column: 12,
- script_name: "gen/cli/bundle/main.js".to_string(),
+ script_name: "CLI_SNAPSHOT.js".to_string(),
function_name: "setLogDebug".to_string(),
is_eval: false,
is_constructor: false,
@@ -417,7 +407,7 @@ mod tests {
assert_eq!(actual.message, "TypeError: baz");
// Because this is accessing the live bundle, this test might be more fragile
assert_eq!(actual.frames.len(), 1);
- assert!(actual.frames[0].script_name.ends_with("js/util.ts"));
+ assert!(actual.frames[0].script_name.ends_with("js/window.ts"));
}
#[test]