diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 668102e3..0525e9de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,10 +51,10 @@ jobs: cargo clippy --all-targets --locked -- -D clippy::all deno lint --ignore=src/html,benches/fixtures,target/ - - name: Tailwind Check - run: | - deno task tailwind - git diff --exit-code + # - name: Tailwind Check + # run: | + # deno task tailwind + # git diff --exit-code - name: Build run: deno task build && cargo build --locked --all-targets diff --git a/.gitignore b/.gitignore index e2e37aa8..94d00793 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /target /js/deno_doc_wasm_bg.wasm +/js/deno_doc_wasm.generated.d.ts /js/deno_doc_wasm.generated.js /js/LICENSE .vscode diff --git a/Cargo.lock b/Cargo.lock index 1cbb6883..1d59e3f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -469,9 +469,9 @@ dependencies = [ [[package]] name = "deno_ast" -version = "0.37.0" +version = "0.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67f9b18b22c707b59cf1ee9cb6f0afbfcf0d03a59b9244ddadacf6a4dc7cfeba" +checksum = "b2be70f80fee64edfbbc4a61c50f18b4a0fbff0b2657d26f6f0443e1db279af9" dependencies = [ "anyhow", "base64", @@ -560,9 +560,9 @@ dependencies = [ [[package]] name = "deno_graph" -version = "0.72.0" +version = "0.73.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "508791f6140a8b5b1ac40bac1842db04281b61db4b64c5fd5bf9f1f7259f328a" +checksum = "046123e4f8de81c7db363d0869d783a5dcd6ceb007b07c6ba4fdf3cc0a82314e" dependencies = [ "anyhow", "async-trait", @@ -587,9 +587,9 @@ dependencies = [ [[package]] name = "deno_media_type" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a798670c20308e5770cc0775de821424ff9e85665b602928509c8c70430b3ee0" +checksum = "a8978229b82552bf8457a0125aa20863f023619cfc21ebb007b1e571d68fd85b" dependencies = [ "data-url", "serde", @@ -1065,9 +1065,9 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -2557,9 +2557,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2567,9 +2567,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", @@ -2582,9 +2582,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -2594,9 +2594,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2604,9 +2604,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", @@ -2617,9 +2617,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" diff --git a/Cargo.toml b/Cargo.toml index dc9ec862..e26facfd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/denoland/deno_doc" members = ["lib"] [workspace.dependencies] -deno_graph = { version = "0.72.0", default-features = false, features = ["symbols"] } +deno_graph = { version = "0.73.1", default-features = false, features = ["symbols"] } import_map = "0.19.0" serde = { version = "1.0.140", features = ["derive"] } diff --git a/benches/doc_parser.rs b/benches/doc_parser.rs index 066adcfd..3ab0571e 100644 --- a/benches/doc_parser.rs +++ b/benches/doc_parser.rs @@ -26,7 +26,7 @@ async fn parse_with_reexports() -> Vec { content: source.as_str(), }, )]; - let mut memory_loader = MemoryLoader::new(sources, vec![]); + let memory_loader = MemoryLoader::new(sources, vec![]); let root = ModuleSpecifier::parse("file:///test/fixtures/deno.d.ts").unwrap(); let analyzer = CapturingModuleAnalyzer::default(); @@ -34,7 +34,7 @@ async fn parse_with_reexports() -> Vec { graph .build( vec![root.clone()], - &mut memory_loader, + &memory_loader, BuildOptions { module_analyzer: &analyzer, ..Default::default() diff --git a/build_css.ts b/build_css.ts index b51ff7e7..7067dfa4 100644 --- a/build_css.ts +++ b/build_css.ts @@ -1,4 +1,4 @@ -import $ from "https://deno.land/x/dax@0.36.0/mod.ts"; +import $ from "jsr:@david/dax@0.40"; import browserslist from "npm:browserslist@4.22.2"; import { browserslistToTargets, transform } from "npm:lightningcss"; diff --git a/deno.json b/deno.json index 92c10083..2379539c 100644 --- a/deno.json +++ b/deno.json @@ -1,7 +1,7 @@ { "lock": false, "tasks": { - "build": "cp LICENSE js/LICENSE && deno run -A https://deno.land/x/wasmbuild@0.15.4/main.ts --project deno_doc_wasm --out js", + "build": "cp LICENSE js/LICENSE && deno run -A jsr:@deno/wasmbuild@0.17.1 --project deno_doc_wasm --out js", "test": "deno test --allow-read --allow-net", "tailwind": "deno run -A build_css.ts", "gen_html": "deno task tailwind && cargo run --example ddoc --features=html -- --name \"std HTTP and Assert\" --html ../deno_std/http/mod.ts ../deno_std/assert/mod.ts ../deno_std/collections/mod.ts --output generated_docs/ --main_entrypoint ../deno_std/assert/mod.ts", diff --git a/examples/ddoc/main.rs b/examples/ddoc/main.rs index 4e609555..b7ea1293 100644 --- a/examples/ddoc/main.rs +++ b/examples/ddoc/main.rs @@ -27,7 +27,7 @@ struct SourceFileLoader {} impl Loader for SourceFileLoader { fn load( - &mut self, + &self, specifier: &ModuleSpecifier, _options: deno_graph::source::LoadOptions, ) -> LoadFuture { @@ -104,13 +104,13 @@ async fn run() -> anyhow::Result<()> { .unwrap() }) .collect(); - let mut loader = SourceFileLoader {}; + let loader = SourceFileLoader {}; let analyzer = CapturingModuleAnalyzer::default(); let mut graph = ModuleGraph::new(GraphKind::TypesOnly); graph .build( source_files.clone(), - &mut loader, + &loader, BuildOptions { module_analyzer: &analyzer, ..Default::default() diff --git a/js/mod.ts b/js/mod.ts index 08519459..449b5bc7 100644 --- a/js/mod.ts +++ b/js/mod.ts @@ -2,16 +2,10 @@ import { instantiate } from "./deno_doc_wasm.generated.js"; import type { DocNode } from "./types.d.ts"; -import { createCache } from "https://deno.land/x/deno_cache@0.7.1/mod.ts"; -import type { - CacheSetting, - LoadResponse, -} from "https://deno.land/x/deno_graph@0.66.0/mod.ts"; +import { createCache } from "jsr:@deno/cache-dir@0.8"; +import type { CacheSetting, LoadResponse } from "jsr:@deno/graph@0.73"; -export type { - CacheSetting, - LoadResponse, -} from "https://deno.land/x/deno_graph@0.66.0/mod.ts"; +export type { CacheSetting, LoadResponse } from "jsr:@deno/graph@0.73"; const encoder = new TextEncoder(); @@ -53,6 +47,7 @@ export interface DocOptions { specifier: string, isDynamic?: boolean, cacheSetting?: CacheSetting, + checksum?: string, ): Promise; /** An optional callback that allows the default resolution logic of the * module graph to be "overridden". This is intended to allow items like an diff --git a/js/test.ts b/js/test.ts index a653171c..295cde16 100644 --- a/js/test.ts +++ b/js/test.ts @@ -1,10 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { - assert, - assertEquals, - assertThrowsAsync, -} from "https://deno.land/std@0.104.0/testing/asserts.ts"; +import { assert, assertEquals, assertRejects } from "jsr:@std/assert@0.223"; import { doc } from "./mod.ts"; Deno.test({ @@ -84,8 +80,8 @@ Deno.test({ name: "doc() - missing specifier", // TODO(@kitsonk) - remove when new deno_graph crate published sanitizeResources: false, - fn() { - return assertThrowsAsync( + async fn() { + await assertRejects( async () => { await doc("https://deno.land/x/bad.ts"); }, @@ -97,8 +93,8 @@ Deno.test({ Deno.test({ name: "doc() - bad specifier", - fn() { - return assertThrowsAsync( + async fn() { + await assertRejects( async () => { await doc("./bad.ts"); }, diff --git a/lib/Cargo.toml b/lib/Cargo.toml index f3745a23..5fc4dfb5 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -21,10 +21,10 @@ import_map.workspace = true serde.workspace = true console_error_panic_hook = "0.1.7" -js-sys = "=0.3.66" +js-sys = "=0.3.69" serde-wasm-bindgen = "=0.5.0" -wasm-bindgen = "=0.2.89" -wasm-bindgen-futures = "=0.4.39" +wasm-bindgen = "=0.2.92" +wasm-bindgen-futures = "=0.4.42" [dev-dependencies] pretty_assertions = "1.0.0" diff --git a/lib/lib.rs b/lib/lib.rs index 552e24df..0ea985f2 100644 --- a/lib/lib.rs +++ b/lib/lib.rs @@ -1,6 +1,4 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// https://github.com/rustwasm/wasm-bindgen/issues/2774 -#![allow(clippy::unused_unit)] use anyhow::anyhow; use anyhow::Context; @@ -46,7 +44,7 @@ impl JsLoader { impl Loader for JsLoader { fn load( - &mut self, + &self, specifier: &ModuleSpecifier, options: LoadOptions, ) -> LoadFuture { diff --git a/src/tests.rs b/src/tests.rs index dccf0fbf..fffe3b8e 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -32,14 +32,14 @@ pub(crate) async fn setup + Copy>( ) }) .collect(); - let mut memory_loader = MemoryLoader::new(sources, vec![]); + let memory_loader = MemoryLoader::new(sources, vec![]); let root = ModuleSpecifier::parse(root.as_ref()).unwrap(); let analyzer = create_analyzer(); let mut graph = ModuleGraph::new(GraphKind::TypesOnly); graph .build( vec![root.clone()], - &mut memory_loader, + &memory_loader, BuildOptions { module_analyzer: &analyzer, ..Default::default() @@ -64,14 +64,14 @@ async fn content_type_handling() { }"#, }, )]; - let mut memory_loader = MemoryLoader::new(sources, vec![]); + let memory_loader = MemoryLoader::new(sources, vec![]); let root = ModuleSpecifier::parse("https://example.com/a").unwrap(); let analyzer = create_analyzer(); let mut graph = ModuleGraph::new(GraphKind::TypesOnly); graph .build( vec![root.clone()], - &mut memory_loader, + &memory_loader, BuildOptions { module_analyzer: &analyzer, ..Default::default() @@ -111,14 +111,14 @@ async fn types_header_handling() { }, ), ]; - let mut memory_loader = MemoryLoader::new(sources, vec![]); + let memory_loader = MemoryLoader::new(sources, vec![]); let root = ModuleSpecifier::parse("https://example.com/a.js").unwrap(); let analyzer = create_analyzer(); let mut graph = ModuleGraph::new(GraphKind::TypesOnly); graph .build( vec![root.clone()], - &mut memory_loader, + &memory_loader, BuildOptions { module_analyzer: &analyzer, ..Default::default() diff --git a/tests/helpers/mod.rs b/tests/helpers/mod.rs index 64993938..5d9db62f 100644 --- a/tests/helpers/mod.rs +++ b/tests/helpers/mod.rs @@ -52,7 +52,7 @@ impl TestBuilder { graph .build( roots.clone(), - &mut self.loader, + &self.loader, BuildOptions { module_analyzer: &analyzer, ..Default::default() diff --git a/tests/html_test.rs b/tests/html_test.rs index 50142bc9..923dbad8 100644 --- a/tests/html_test.rs +++ b/tests/html_test.rs @@ -21,7 +21,7 @@ struct SourceFileLoader {} impl Loader for SourceFileLoader { fn load( - &mut self, + &self, specifier: &ModuleSpecifier, _options: LoadOptions, ) -> LoadFuture { @@ -93,13 +93,13 @@ async fn get_files(subpath: &str) -> IndexMap> { }) .collect(); - let mut loader = SourceFileLoader {}; + let loader = SourceFileLoader {}; let analyzer = CapturingModuleAnalyzer::default(); let mut graph = ModuleGraph::new(GraphKind::TypesOnly); graph .build( source_files.clone(), - &mut loader, + &loader, BuildOptions { module_analyzer: &analyzer, ..Default::default()