Skip to content

Commit

Permalink
Merge deno_cli_snapshots into deno_cli (denoland#3064)
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Oct 5, 2019
1 parent 9049213 commit b81e5db
Show file tree
Hide file tree
Showing 148 changed files with 38 additions and 83 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/js/deps/
cli/tests/error_syntax.js
9 changes: 0 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ members = [
"core",
"tools/hyper_hello",
"deno_typescript",
"js",
]
4 changes: 3 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ path = "lib.rs"
name = "deno"
path = "main.rs"

[build-dependencies]
deno_typescript = { path = "../deno_typescript", version = "0.19.0" }

[dependencies]
deno = { path = "../core", version = "0.19.0" }
deno_cli_snapshots = { path = "../js", version = "0.19.0" }
deno_typescript = { path = "../deno_typescript", version = "0.19.0" }

ansi_term = "0.12.1"
Expand Down
4 changes: 2 additions & 2 deletions js/build.rs → cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ fn main() {
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());

let root_names = vec![c.join("main.ts")];
let root_names = vec![c.join("js/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![c.join("compiler.ts")];
let root_names = vec![c.join("js/compiler.ts")];
let bundle = o.join("COMPILER_SNAPSHOT.js");
let state = deno_typescript::compile_bundle(&bundle, root_names).unwrap();
assert!(bundle.exists());
Expand Down
4 changes: 0 additions & 4 deletions cli/file_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,8 +1284,6 @@ mod tests {
assert!(r.is_err());

let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.join("js/main.ts")
.to_owned();
let specifier =
Expand All @@ -1308,8 +1306,6 @@ mod tests {
assert!(r.is_err());

let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.join("js/main.ts")
.to_owned();
let specifier =
Expand Down
4 changes: 3 additions & 1 deletion js/lib.rs → cli/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ 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"));
#[allow(dead_code)]
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"));
#[allow(dead_code)]
pub static COMPILER_SNAPSHOT_DTS: &[u8] =
include_bytes!(concat!(env!("OUT_DIR"), "/COMPILER_SNAPSHOT.d.ts"));

static DENO_RUNTIME: &str = include_str!("lib.deno_runtime.d.ts");
static DENO_RUNTIME: &str = include_str!("js/lib.deno_runtime.d.ts");

/// Same as deno_typescript::get_asset but also has lib.deno_runtime.d.ts
pub fn get_asset(name: &str) -> Option<&'static str> {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions js/test_util.ts → cli/js/test_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// tests by the special string. permW1N0 means allow-write but not allow-net.
// See tools/unit_tests.py for more details.

import * as testing from "../std/testing/mod.ts";
import { assert, assertEquals } from "../std/testing/asserts.ts";
import * as testing from "../../std/testing/mod.ts";
import { assert, assertEquals } from "../../std/testing/asserts.ts";
export {
assert,
assertThrows,
Expand All @@ -18,7 +18,7 @@ export {
assertStrictEq,
assertStrContains,
unreachable
} from "../std/testing/asserts.ts";
} from "../../std/testing/asserts.ts";

interface TestPermissions {
read?: boolean;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions js/unit_test_runner.ts → cli/js/unit_test_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async function main(): Promise<void> {
"run",
"--no-prompt",
...cliPerms,
"js/unit_tests.ts"
"cli/js/unit_tests.ts"
];

const p = Deno.run({
Expand All @@ -73,7 +73,7 @@ async function main(): Promise<void> {
let result = 0;

if (!actual && !expected) {
console.error("Bad js/unit_test.ts output");
console.error("Bad cli/js/unit_test.ts output");
result = 1;
} else if (expected !== actual) {
result = 1;
Expand Down
6 changes: 3 additions & 3 deletions js/unit_tests.ts → cli/js/unit_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.

// This test is executed as part of tools/test.py
// But it can also be run manually: ./target/debug/deno js/unit_tests.ts
// But it can also be run manually: ./target/debug/deno cli/js/unit_tests.ts

import "./blob_test.ts";
import "./body_test.ts";
Expand Down Expand Up @@ -53,9 +53,9 @@ import "./performance_test.ts";
import "./permissions_test.ts";
import "./version_test.ts";

import "../website/app_test.ts";
import "../../website/app_test.ts";

import { runIfMain } from "../std/testing/mod.ts";
import { runIfMain } from "../../std/testing/mod.ts";

async function main(): Promise<void> {
// Testing entire test suite serially
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions cli/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ extern crate futures;
extern crate serde_json;
extern crate clap;
extern crate deno;
extern crate deno_cli_snapshots;
extern crate indexmap;
#[cfg(unix)]
extern crate nix;
Expand All @@ -32,6 +31,7 @@ mod global_timer;
mod http_body;
mod http_util;
mod import_map;
mod js;
pub mod msg;
pub mod ops;
pub mod permissions;
Expand Down Expand Up @@ -121,7 +121,7 @@ fn create_worker_and_state(
}

fn types_command() {
let content = deno_cli_snapshots::get_asset("lib.deno_runtime.d.ts").unwrap();
let content = crate::js::get_asset("lib.deno_runtime.d.ts").unwrap();
println!("{}", content);
}

Expand Down
2 changes: 1 addition & 1 deletion cli/ops/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub fn op_fetch_asset(
_zero_copy: Option<PinnedBuf>,
) -> Result<JsonOp, ErrBox> {
let args: FetchAssetArgs = serde_json::from_value(args)?;
if let Some(source_code) = deno_cli_snapshots::get_asset(&args.name) {
if let Some(source_code) = crate::js::get_asset(&args.name) {
Ok(JsonOp::Sync(json!(source_code)))
} else {
panic!("op_fetch_asset bad asset {}", args.name)
Expand Down
4 changes: 2 additions & 2 deletions cli/source_maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ fn builtin_source_map(_: &str) -> Option<Vec<u8>> {
#[cfg(not(feature = "check-only"))]
fn builtin_source_map(script_name: &str) -> Option<Vec<u8>> {
if script_name.ends_with("CLI_SNAPSHOT.js") {
Some(deno_cli_snapshots::CLI_SNAPSHOT_MAP.to_vec())
Some(crate::js::CLI_SNAPSHOT_MAP.to_vec())
} else if script_name.ends_with("COMPILER_SNAPSHOT.js") {
Some(deno_cli_snapshots::COMPILER_SNAPSHOT_MAP.to_vec())
Some(crate::js::COMPILER_SNAPSHOT_MAP.to_vec())
} else {
None
}
Expand Down
4 changes: 2 additions & 2 deletions cli/startup_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#[cfg(feature = "no-snapshot-init")]
use deno::Script;

use crate::js::CLI_SNAPSHOT;
use crate::js::COMPILER_SNAPSHOT;
use deno::StartupData;
use deno_cli_snapshots::CLI_SNAPSHOT;
use deno_cli_snapshots::COMPILER_SNAPSHOT;

#[cfg(feature = "no-snapshot-init")]
pub fn deno_isolate_init() -> StartupData<'static> {
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn js_unit_tests() {
.arg("--reload")
.arg("--allow-run")
.arg("--allow-env")
.arg("js/unit_test_runner.ts")
.arg("cli/js/unit_test_runner.ts")
.spawn()
.expect("failed to spawn script");
let status = deno.wait().expect("failed to wait for the child process");
Expand Down
2 changes: 1 addition & 1 deletion cli/version.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
pub const DENO: &str = env!("CARGO_PKG_VERSION");
pub const TYPESCRIPT: &str = deno_cli_snapshots::TS_VERSION;
pub const TYPESCRIPT: &str = crate::js::TS_VERSION;

pub fn v8() -> &'static str {
deno::v8_version()
Expand Down
25 changes: 0 additions & 25 deletions js/Cargo.toml

This file was deleted.

10 changes: 0 additions & 10 deletions js/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions tools/cargo_publish_others.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ def main():
os.chdir(os.path.join(root_path, "deno_typescript"))
run(cargo_publish)

# Publish the deno_cli_snapshots crate.
os.chdir(os.path.join(root_path, "js"))
run(cargo_publish)

# Publish the deno_cli crate.
os.chdir(os.path.join(root_path, "cli"))
run(cargo_publish)
Expand Down
11 changes: 8 additions & 3 deletions tools/complex_permissions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def test_inside_test_dir(self):
def test_outside_test_and_js_dir(self):
code, _stdout, stderr = self._run_deno([
"--allow-" + self.test_type + "=" + os.path.join(
root_path, "cli/tests") + "," + os.path.join(root_path, "js")
root_path, "cli/tests") + "," + os.path.join(
root_path, "cli/js")
], [self.test_type, "package.json"])
assert code == 1
assert PROMPT_PATTERN not in stderr
Expand All @@ -64,8 +65,12 @@ def test_outside_test_and_js_dir(self):
def test_inside_test_and_js_dir(self):
code, _stdout, stderr = self._run_deno([
"--allow-" + self.test_type + "=" + os.path.join(
root_path, "cli/tests") + "," + os.path.join(root_path, "js")
], [self.test_type, "js/dir_test.ts", "cli/tests/subdir/config.json"])
root_path, "cli/tests") + "," + os.path.join(
root_path, "cli/js")
], [
self.test_type, "cli/js/dir_test.ts",
"cli/tests/subdir/config.json"
])
assert code == 0
assert PROMPT_PATTERN not in stderr
assert PERMISSION_DENIED_PATTERN not in stderr
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"types": []
},
"files": [
"js/lib.web_assembly.d.ts",
"js/lib.deno_runtime.d.ts",
"js/main.ts",
"js/compiler.ts"
"cli/js/lib.web_assembly.d.ts",
"cli/js/lib.deno_runtime.d.ts",
"cli/js/main.ts",
"cli/js/compiler.ts"
]
}
2 changes: 1 addition & 1 deletion website/app_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.

import { test, assertEquals } from "../js/test_util.ts";
import { test, assertEquals } from "../cli/js/test_util.ts";
import { runIfMain } from "../std/testing/mod.ts";
import {
BenchmarkRun,
Expand Down

0 comments on commit b81e5db

Please sign in to comment.