diff --git a/Cargo.lock b/Cargo.lock index c76b2c38..ed45a681 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,7 +52,18 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.18", + "syn 2.0.29", +] + +[[package]] +name = "async-trait" +version = "0.1.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", ] [[package]] @@ -173,7 +184,7 @@ checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ "bitflags 1.3.2", "clap_lex", - "indexmap", + "indexmap 1.9.2", "textwrap 0.16.0", ] @@ -289,15 +300,15 @@ dependencies = [ [[package]] name = "data-url" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5" +checksum = "41b319d1b62ffbd002e057f36bebd1f42b9f97927c9577461d855f3513c4289f" [[package]] name = "deno_ast" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00c93119b1c487a85603406a988a0ca9a1d0e5315404cccc5c158fb484b1f5a2" +checksum = "b041461b8b531a409fc635a5a476aee79b82f2c502d1d279c5995b6768ed944a" dependencies = [ "deno_media_type", "dprint-swc-ext", @@ -340,16 +351,17 @@ dependencies = [ [[package]] name = "deno_graph" -version = "0.52.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6acc743895f5e83c985d632998e58af1395c862b28acabd3d290540ef4d57354" +checksum = "dcb7464fab13748a26407d0250ab3fb412a88d8b95c30b8a96aa5d49c79d4ee6" dependencies = [ "anyhow", + "async-trait", "data-url", "deno_ast", "deno_semver", "futures", - "indexmap", + "indexmap 2.0.0", "monch", "once_cell", "parking_lot", @@ -362,9 +374,9 @@ dependencies = [ [[package]] name = "deno_media_type" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63772a60d740a41d97fbffb4788fc3779e6df47289e01892c12be38f4a5beded" +checksum = "a798670c20308e5770cc0775de821424ff9e85665b602928509c8c70430b3ee0" dependencies = [ "data-url", "serde", @@ -392,9 +404,9 @@ checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" [[package]] name = "dprint-swc-ext" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f115ea5b6f5d0d02a25a9364f41b8c4f857452c299309dcfd29a694724d0566" +checksum = "6a0a2492465344a58a37ae119de59e81fe5a2885f2711c7b5048ef0dfa14ce42" dependencies = [ "bumpalo", "num-bigint", @@ -412,6 +424,12 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "form_urlencoded" version = "1.2.0" @@ -430,7 +448,7 @@ dependencies = [ "pmutil", "proc-macro2", "swc_macros_common", - "syn 2.0.18", + "syn 2.0.29", ] [[package]] @@ -545,6 +563,12 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -571,7 +595,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "632089ec08bd62e807311104122fb26d5c911ab172e2b9864be154a575979e29" dependencies = [ "cfg-if", - "indexmap", + "indexmap 1.9.2", "log", "serde", "serde_json", @@ -585,7 +609,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.1", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", "serde", ] @@ -599,7 +634,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.29", ] [[package]] @@ -859,7 +894,7 @@ checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.29", ] [[package]] @@ -888,9 +923,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -906,9 +941,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.28" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -1064,7 +1099,7 @@ version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" dependencies = [ - "indexmap", + "indexmap 1.9.2", "itoa", "ryu", "serde", @@ -1179,7 +1214,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.18", + "syn 2.0.29", ] [[package]] @@ -1190,9 +1225,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "swc_atoms" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8066e17abb484602da673e2d35138ab32ce53f26368d9c92113510e1659220b" +checksum = "9f54563d7dcba626d4acfe14ed12def7ecc28e004debe3ecd2c3ee07cc47e449" dependencies = [ "once_cell", "rustc-hash", @@ -1204,9 +1239,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.31.21" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5823ef063f116ad281cde9700f5be6dfb182e543ce3f62c42cee1c03ffbc6b" +checksum = "39cb7fcd56655c8ae7dcf2344f0be6cbff4d9c7cb401fe3ec8e56e1de8dfe582" dependencies = [ "ast_node", "better_scoped_tls", @@ -1230,9 +1265,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.107.7" +version = "0.109.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7191c8c57af059b75a2aadc927a2608c3962d19e4d09ce8f9c3f03739ddf833" +checksum = "7bc2286cedd688a68f214faa1c19bb5cceab7c9c54d0cbe3273e4c1704e38f69" dependencies = [ "bitflags 2.4.0", "is-macro", @@ -1247,9 +1282,9 @@ dependencies = [ [[package]] name = "swc_ecma_dep_graph" -version = "0.109.15" +version = "0.111.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1295557b5960eb97ec63fc2008be0a101d1ff7d2163a1031b3d31d3c898d5bb3" +checksum = "c5526adf6a434f145c8caf7e3a2dba554a2ad09b84467b6a62210f9ef0af0f71" dependencies = [ "swc_atoms", "swc_common", @@ -1259,9 +1294,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.137.15" +version = "0.139.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c0d554865a63bfa58cf1c433fa91d7d4adf40030fa8e4530e8065d0578166a" +checksum = "3eab46cb863bc5cd61535464e07e5b74d5f792fa26a27b9f6fd4c8daca9903b7" dependencies = [ "either", "num-bigint", @@ -1279,9 +1314,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.93.7" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb23a48abd9f5731b6275dbf4ea89f6e03dc60b7c8e3e1e383bb4a6c39fd7e25" +checksum = "0f628ec196e76e67892441e14eef2e423a738543d32bffdabfeec20c29582117" dependencies = [ "num-bigint", "swc_atoms", @@ -1300,7 +1335,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.29", ] [[package]] @@ -1312,7 +1347,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.29", ] [[package]] @@ -1336,7 +1371,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.18", + "syn 2.0.29", ] [[package]] @@ -1352,9 +1387,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ "proc-macro2", "quote", @@ -1490,7 +1525,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.29", ] [[package]] @@ -1619,7 +1654,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.29", "wasm-bindgen-shared", ] @@ -1653,7 +1688,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.29", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Cargo.toml b/Cargo.toml index 0a848811..1c0868bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,8 +17,8 @@ name = "ddoc" [dependencies] anyhow = { version = "1.0.58", optional = true } cfg-if = "1.0.0" -deno_ast = "0.28.0" -deno_graph = "0.52.0" +deno_ast = "0.29.0" +deno_graph = "0.54.0" futures = "0.3.26" import_map = "0.15.0" lazy_static = "1.4.0" diff --git a/examples/ddoc/main.rs b/examples/ddoc/main.rs index e79fba5d..8b59857a 100644 --- a/examples/ddoc/main.rs +++ b/examples/ddoc/main.rs @@ -26,6 +26,7 @@ impl Loader for SourceFileLoader { &mut self, specifier: &ModuleSpecifier, _is_dynamic: bool, + _cache_setting: deno_graph::source::CacheSetting, ) -> LoadFuture { let result = if specifier.scheme() == "file" { let path = specifier.to_file_path().unwrap(); diff --git a/js/mod.ts b/js/mod.ts index 41feb000..1c867108 100644 --- a/js/mod.ts +++ b/js/mod.ts @@ -2,10 +2,16 @@ import { instantiate } from "./deno_doc.generated.js"; import type { DocNode } from "./types.d.ts"; -import { load as defaultLoad } from "https://deno.land/x/deno_graph@0.49.0/loader.ts"; -import type { LoadResponse } from "https://deno.land/x/deno_graph@0.49.0/mod.ts"; +import { load as defaultLoad } from "https://deno.land/x/deno_graph@0.53.0/loader.ts"; +import type { + CacheSetting, + LoadResponse, +} from "https://deno.land/x/deno_graph@0.53.0/mod.ts"; -export type { LoadResponse } from "https://deno.land/x/deno_graph@0.49.0/mod.ts"; +export type { + CacheSetting, + LoadResponse, +} from "https://deno.land/x/deno_graph@0.53.0/mod.ts"; export interface DocOptions { /** An optional URL string which provides a location of an import map to be @@ -38,7 +44,8 @@ export interface DocOptions { */ load?( specifier: string, - isDynamic: boolean, + isDynamic?: boolean, + cacheSetting?: CacheSetting, ): 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/src/js.rs b/src/js.rs index c9ddbfe4..9bd30415 100644 --- a/src/js.rs +++ b/src/js.rs @@ -6,6 +6,7 @@ use crate::parser::DocParser; use anyhow::anyhow; use anyhow::Result; +use deno_graph::source::CacheSetting; use deno_graph::source::LoadFuture; use deno_graph::source::LoadResponse; use deno_graph::source::Loader; @@ -45,11 +46,13 @@ impl Loader for JsLoader { &mut self, specifier: &ModuleSpecifier, is_dynamic: bool, + cache_setting: CacheSetting, ) -> LoadFuture { let this = JsValue::null(); let arg0 = JsValue::from(specifier.to_string()); let arg1 = JsValue::from(is_dynamic); - let result = self.load.call2(&this, &arg0, &arg1); + let arg2 = JsValue::from(cache_setting.as_js_str()); + let result = self.load.call3(&this, &arg0, &arg1, &arg2); let f = async move { let response = match result { Ok(result) => JsFuture::from(js_sys::Promise::resolve(&result)).await, @@ -135,7 +138,7 @@ pub async fn doc( if let Some(LoadResponse::Module { content, specifier, .. }) = loader - .load(&import_map_specifier, false) + .load(&import_map_specifier, false, CacheSetting::Use) .await .map_err(|err| JsValue::from(js_sys::Error::new(&err.to_string())))? {