summaryrefslogtreecommitdiff
path: root/cli_snapshots
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-09-15 18:36:27 -0400
committerGitHub <noreply@github.com>2019-09-15 18:36:27 -0400
commitc9ef182886cc07d35a5b27fb89163d8cf21a6a47 (patch)
tree6ba1605daa7e9e8cac3f6b926374086906f571b5 /cli_snapshots
parent1d305c2ac785af6b28649f2023d5008e390eeca0 (diff)
Make deno_cli installable via crates.io (#2946)
- Fixes cargo publish on deno_typescript, deno_cli_snapshots, and deno_cli. - Combines cli_snapshots and js into one directory. - Extracts TS version at compile time rather than runtime - Bumps version awkwardly - it was necessary to test end-to-end publishing. Sorry. - Adds git submodule deno_typescript/typescript
Diffstat (limited to 'cli_snapshots')
-rw-r--r--cli_snapshots/Cargo.toml18
-rw-r--r--cli_snapshots/README.md9
-rw-r--r--cli_snapshots/build.rs24
-rw-r--r--cli_snapshots/lib.rs43
4 files changed, 0 insertions, 94 deletions
diff --git a/cli_snapshots/Cargo.toml b/cli_snapshots/Cargo.toml
deleted file mode 100644
index 7762d5375..000000000
--- a/cli_snapshots/Cargo.toml
+++ /dev/null
@@ -1,18 +0,0 @@
-[package]
-name = "deno_cli_snapshots"
-version = "0.18.0"
-license = "MIT"
-authors = ["Ryan Dahl <ry@tinyclouds.org>"]
-edition = "2018"
-description = "Provides snapshots for the deno CLI"
-repository = "https://github.com/ry/deno_typescript"
-
-[lib]
-path = "lib.rs"
-
-[dev-dependencies]
-deno = { path = "../core" }
-
-[build-dependencies]
-deno_typescript = { path = "../deno_typescript" }
-
diff --git a/cli_snapshots/README.md b/cli_snapshots/README.md
deleted file mode 100644
index 427429a2b..000000000
--- a/cli_snapshots/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-This is a small crate which exports just a few static blobs. It contains a
-build.rs file which compiles Deno's internal JavaScript and TypeScript code
-first into a single AMD bundle, and then into a binary V8 Snapshot.
-
-The main Deno executable crate ("cli") depends on this crate and has access to
-all the runtime code.
-
-The //js/ directory should be moved as a sub-directory of this crate, to denote
-the dependency structure. However, that is left to future work.
diff --git a/cli_snapshots/build.rs b/cli_snapshots/build.rs
deleted file mode 100644
index cffa3d6b3..000000000
--- a/cli_snapshots/build.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-use std::env;
-use std::path::PathBuf;
-
-fn main() {
- // To debug snapshot issues uncomment:
- // deno_typescript::trace_serializer();
-
- let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
- let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());
- let js_dir = c.join("../js");
-
- let root_names = vec![js_dir.join("main.ts")];
- let bundle = o.join("CLI_SNAPSHOT.js");
- let state = deno_typescript::compile_bundle(&bundle, root_names).unwrap();
- assert!(bundle.exists());
- deno_typescript::mksnapshot_bundle(&bundle, state).unwrap();
-
- let root_names = vec![js_dir.join("compiler.ts")];
- let bundle = o.join("COMPILER_SNAPSHOT.js");
- let state = deno_typescript::compile_bundle(&bundle, root_names).unwrap();
- assert!(bundle.exists());
- deno_typescript::mksnapshot_bundle_ts(&bundle, state).unwrap();
-}
diff --git a/cli_snapshots/lib.rs b/cli_snapshots/lib.rs
deleted file mode 100644
index 1147e7903..000000000
--- a/cli_snapshots/lib.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-pub static CLI_SNAPSHOT: &[u8] =
- include_bytes!(concat!(env!("OUT_DIR"), "/CLI_SNAPSHOT.bin"));
-pub static CLI_SNAPSHOT_MAP: &[u8] =
- include_bytes!(concat!(env!("OUT_DIR"), "/CLI_SNAPSHOT.js.map"));
-pub static CLI_SNAPSHOT_DTS: &[u8] =
- include_bytes!(concat!(env!("OUT_DIR"), "/CLI_SNAPSHOT.d.ts"));
-
-pub static COMPILER_SNAPSHOT: &[u8] =
- include_bytes!(concat!(env!("OUT_DIR"), "/COMPILER_SNAPSHOT.bin"));
-pub static COMPILER_SNAPSHOT_MAP: &[u8] =
- include_bytes!(concat!(env!("OUT_DIR"), "/COMPILER_SNAPSHOT.js.map"));
-pub static COMPILER_SNAPSHOT_DTS: &[u8] =
- include_bytes!(concat!(env!("OUT_DIR"), "/COMPILER_SNAPSHOT.d.ts"));
-
-#[test]
-fn cli_snapshot() {
- let mut isolate =
- deno::Isolate::new(deno::StartupData::Snapshot(CLI_SNAPSHOT), false);
- deno::js_check(isolate.execute(
- "<anon>",
- r#"
- if (!window) {
- throw Error("bad");
- }
- console.log("we have console.log!!!");
- "#,
- ));
-}
-
-#[test]
-fn compiler_snapshot() {
- let mut isolate =
- deno::Isolate::new(deno::StartupData::Snapshot(COMPILER_SNAPSHOT), false);
- deno::js_check(isolate.execute(
- "<anon>",
- r#"
- if (!compilerMain) {
- throw Error("bad");
- }
- console.log(`ts version: ${ts.version}`);
- "#,
- ));
-}