diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/Cargo.toml | 12 | ||||
-rw-r--r-- | cli/tests/bundle.test.out | 6 | ||||
-rw-r--r-- | cli/tests/bundle/fixture01.out | 4 | ||||
-rw-r--r-- | cli/tests/bundle/fixture02.out | 14 | ||||
-rw-r--r-- | cli/tests/bundle/fixture03.out | 2 | ||||
-rw-r--r-- | cli/tests/bundle/fixture08.out | 6 | ||||
-rw-r--r-- | cli/tests/bundle/fixture09.out | 19 | ||||
-rw-r--r-- | cli/tests/bundle/fixture10.out | 5 | ||||
-rw-r--r-- | cli/tests/bundle/fixture11.out | 20 | ||||
-rw-r--r-- | cli/tests/bundle/fixture14.out | 31 | ||||
-rw-r--r-- | cli/tests/integration_tests.rs | 2 | ||||
-rw-r--r-- | cli/tests/unit/webgpu_test.ts | 3 | ||||
-rw-r--r-- | cli/tools/doc.rs | 17 |
13 files changed, 50 insertions, 91 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index c7530ee4e..5c5a12f0e 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -35,8 +35,8 @@ winres = "0.1.11" [dependencies] deno_core = { path = "../core", version = "0.79.0" } -deno_doc = "0.1.22" -deno_lint = "0.2.18" +deno_doc = "0.1.23" +deno_lint = "0.2.19" deno_runtime = { path = "../runtime", version = "0.9.0" } atty = "0.2.14" @@ -44,7 +44,7 @@ base64 = "0.13.0" byteorder = "1.4.2" clap = "2.33.3" dissimilar = "1.0.2" -dprint-plugin-typescript = "0.40.3" +dprint-plugin-typescript = "0.41.0" dprint-plugin-markdown = "0.5.1" dprint-plugin-json = "0.8.0" encoding_rs = "0.8.28" @@ -68,9 +68,9 @@ semver-parser = "0.10.2" serde = { version = "1.0.123", features = ["derive"] } shell-escape = "0.1.5" sourcemap = "6.0.1" -swc_bundler = "0.21.0" -swc_common = { version = "0.10.9", features = ["sourcemap"] } -swc_ecmascript = { version = "0.20.0", features = ["codegen", "dep_graph", "parser", "proposal", "react", "transforms", "typescript", "visit"] } +swc_bundler = "0.25.1" +swc_common = { version = "0.10.12", features = ["sourcemap"] } +swc_ecmascript = { version = "0.24.1", features = ["codegen", "dep_graph", "parser", "proposal", "react", "transforms", "typescript", "visit"] } tempfile = "3.2.0" termcolor = "1.1.2" text-size = "1.1.0" diff --git a/cli/tests/bundle.test.out b/cli/tests/bundle.test.out index b21e53b42..030c09295 100644 --- a/cli/tests/bundle.test.out +++ b/cli/tests/bundle.test.out @@ -11,17 +11,17 @@ function printHello2() { function returnsHi1() { return "Hi"; } -export { returnsHi1 as returnsHi }; function returnsFoo21() { return returnsFoo(); } -export { returnsFoo21 as returnsFoo2 }; function printHello31() { printHello2(); } -export { printHello31 as printHello3 }; function throwsError1() { throw Error("exception from mod1"); } +export { returnsHi1 as returnsHi }; +export { returnsFoo21 as returnsFoo2 }; +export { printHello31 as printHello3 }; export { throwsError1 as throwsError }; diff --git a/cli/tests/bundle/fixture01.out b/cli/tests/bundle/fixture01.out index c6d2bd6d7..a825140b7 100644 --- a/cli/tests/bundle/fixture01.out +++ b/cli/tests/bundle/fixture01.out @@ -1,7 +1,7 @@ +const a = "a"; const mod = function() { - const a = "a"; return { - a + a: a }; }(); console.log(mod); diff --git a/cli/tests/bundle/fixture02.out b/cli/tests/bundle/fixture02.out index f831aac2e..b3544182b 100644 --- a/cli/tests/bundle/fixture02.out +++ b/cli/tests/bundle/fixture02.out @@ -1,16 +1,12 @@ -const b = "b"; -console.log(b); +const c = "c"; +class C { +} const mod = function() { - const c = "c"; - const c1 = c; - class C { - } - const __default = C; - const __default1 = C; return { c: c, default: C }; }(); -const c = mod; +const b = "b"; +console.log(b); console.log(mod); diff --git a/cli/tests/bundle/fixture03.out b/cli/tests/bundle/fixture03.out index 93659f4d9..524e77abb 100644 --- a/cli/tests/bundle/fixture03.out +++ b/cli/tests/bundle/fixture03.out @@ -1,5 +1,5 @@ const a = "a"; const d = { - a: a + a }; console.log(d); diff --git a/cli/tests/bundle/fixture08.out b/cli/tests/bundle/fixture08.out index 7ddb20077..bfe40aa37 100644 --- a/cli/tests/bundle/fixture08.out +++ b/cli/tests/bundle/fixture08.out @@ -1,9 +1,7 @@ +const a1 = "a"; const mod = function() { - const a = "a"; - const a1 = a; return { - a: a + a: a1 }; }(); -const a = mod; export { mod as a }; diff --git a/cli/tests/bundle/fixture09.out b/cli/tests/bundle/fixture09.out index e7396f493..e06cc92de 100644 --- a/cli/tests/bundle/fixture09.out +++ b/cli/tests/bundle/fixture09.out @@ -1,20 +1,19 @@ +function a3(...d) { + return d.join(" "); +} const mod = function() { - function a(...d) { - return d.join(" "); - } return { - a + a: a3 }; }(); +function a1(...d) { + return d.join("/"); +} const mod1 = function() { - function a(...d) { - return d.join("/"); - } return { - a + a: a1 }; }(); const k = globalThis.value ? mod : mod1; const { a: a2 , } = k; -const a1 = a2; -export { a1 as a }; +export { a2 as a }; diff --git a/cli/tests/bundle/fixture10.out b/cli/tests/bundle/fixture10.out index 776aac1ae..5491e5e7f 100644 --- a/cli/tests/bundle/fixture10.out +++ b/cli/tests/bundle/fixture10.out @@ -1,6 +1,5 @@ const a = "a"; -const a1 = a; const o = { }; -const { a: a2 = a1 } = o; -console.log(a2); +const { a: a1 = a } = o; +console.log(a1); diff --git a/cli/tests/bundle/fixture11.out b/cli/tests/bundle/fixture11.out index 876eb45ac..d143e8723 100644 --- a/cli/tests/bundle/fixture11.out +++ b/cli/tests/bundle/fixture11.out @@ -1,25 +1,21 @@ function a() { console.log("a"); } -const a1 = a; -var O3; +var O1; (function(O1) { O1[O1["A"] = 0] = "A"; O1[O1["B"] = 1] = "B"; O1[O1["C"] = 2] = "C"; -})(O3 || (O3 = { +})(O1 || (O1 = { })); -const O1 = O3; -const a2 = a1; -const O2 = O1; -export { O2 as O }; +export { O1 as O }; class A { #a; #c; constructor(o = { }){ - const { a: a3 = a2 , c , } = o; - this.#a = a3; + const { a: a1 = a , c , } = o; + this.#a = a1; this.#c = c; } a() { @@ -29,6 +25,6 @@ class A { console.log(this.#c); } } -const a4 = new A(); -a4.a(); -a4.c(); +const a2 = new A(); +a2.a(); +a2.c(); diff --git a/cli/tests/bundle/fixture14.out b/cli/tests/bundle/fixture14.out index 2534a7015..392bb6478 100644 --- a/cli/tests/bundle/fixture14.out +++ b/cli/tests/bundle/fixture14.out @@ -1,31 +1,2 @@ -const mod = function() { - const mod1 = []; - return { - mod: mod1 - }; -}(); +const mod = []; console.log(mod); -const mod1 = function() { - const c = []; - const c1 = c; - return { - c: c - }; -}(); -const c = mod1; -const mod2 = function() { - const b = []; - const b1 = b; - return { - b: b - }; -}(); -const b = mod2; -const mod3 = function() { - const a = []; - const a1 = a; - return { - a: a - }; -}(); -const a = mod3; diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index d07fe1b22..022bd5572 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1473,7 +1473,7 @@ mod integration { assert!(std::str::from_utf8(&output.stdout) .unwrap() .trim() - .ends_with("f1\nf2")); + .ends_with("f2\nf1")); assert_eq!(output.stderr, b""); } diff --git a/cli/tests/unit/webgpu_test.ts b/cli/tests/unit/webgpu_test.ts index 628a3c8db..d40851dfa 100644 --- a/cli/tests/unit/webgpu_test.ts +++ b/cli/tests/unit/webgpu_test.ts @@ -1,6 +1,3 @@ -// TODO(lucacasonato): remove when GPUBufferUsage and friends are added to dlint -// deno-lint-ignore-file no-undef - import { assert, assertEquals, unitTest } from "./test_util.ts"; let isCI: boolean; diff --git a/cli/tools/doc.rs b/cli/tools/doc.rs index 9725076d6..938944f2a 100644 --- a/cli/tools/doc.rs +++ b/cli/tools/doc.rs @@ -22,6 +22,9 @@ use std::path::PathBuf; use std::pin::Pin; use std::sync::Arc; use std::sync::Mutex; +use swc_ecmascript::parser::Syntax; + +type DocResult = Result<(Syntax, String), doc::DocError>; /// When parsing lib.deno.d.ts, only `DocParser::parse_source` is used, /// which never even references the loader, so this is just a stub for that scenario. @@ -41,7 +44,7 @@ impl DocFileLoader for StubDocLoader { fn load_source_code( &self, _specifier: &str, - ) -> Pin<Box<dyn Future<Output = Result<String, doc::DocError>>>> { + ) -> Pin<Box<dyn Future<Output = DocResult>>> { unreachable!() } } @@ -63,11 +66,14 @@ impl DocFileLoader for module_graph::Graph { fn load_source_code( &self, specifier: &str, - ) -> Pin<Box<dyn Future<Output = Result<String, doc::DocError>>>> { + ) -> Pin<Box<dyn Future<Output = DocResult>>> { let specifier = resolve_url_or_path(specifier).expect("Expected valid specifier"); let source = self.get_source(&specifier).expect("Unknown dependency"); - async move { Ok(source) }.boxed_local() + let media_type = + self.get_media_type(&specifier).expect("Unknown media type"); + let syntax = ast::get_syntax(&media_type); + async move { Ok((syntax, source)) }.boxed_local() } } @@ -122,10 +128,7 @@ pub async fn print_docs( let doc_parser = doc::DocParser::new(Box::new(graph), private); doc_parser - .parse_with_reexports( - root_specifier.as_str(), - ast::get_syntax(&MediaType::TypeScript), - ) + .parse_with_reexports(root_specifier.as_str()) .await }; |