Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Aug 31, 2023
1 parent 29321e4 commit 1e70637
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ name = "ddoc"
anyhow = { version = "1.0.58", optional = true }
cfg-if = "1.0.0"
deno_ast = "0.29.0"
deno_graph = "0.53.0"
deno_graph = "0.54.0"
futures = "0.3.26"
import_map = "0.15.0"
lazy_static = "1.4.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/ddoc/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ use std::fs::read_to_string;
struct SourceFileLoader {}

impl Loader for SourceFileLoader {
fn load_with_cache_setting(
fn load(
&mut self,
specifier: &ModuleSpecifier,
_is_dynamic: bool,
_cache_setting: deno_graph::source::LoaderCacheSetting,
_cache_setting: deno_graph::source::CacheSetting,
) -> LoadFuture {
let result = if specifier.scheme() == "file" {
let path = specifier.to_file_path().unwrap();
Expand Down
15 changes: 5 additions & 10 deletions src/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ 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;
use deno_graph::source::LoaderCacheSetting;
use deno_graph::source::Resolver;
use deno_graph::BuildOptions;
use deno_graph::CapturingModuleAnalyzer;
Expand Down Expand Up @@ -42,21 +42,16 @@ impl JsLoader {
}

impl Loader for JsLoader {
fn load_with_cache_setting(
fn load(
&mut self,
specifier: &ModuleSpecifier,
is_dynamic: bool,
cache_setting: LoaderCacheSetting,
cache_setting: CacheSetting,
) -> LoadFuture {
let this = JsValue::null();
let arg0 = JsValue::from(specifier.to_string());
let arg1 = JsValue::from(is_dynamic);
let arg2 = JsValue::from(match cache_setting {
// note: keep these values aligned with deno_cache
LoaderCacheSetting::Only => "only",
LoaderCacheSetting::Prefer => "prefer",
LoaderCacheSetting::Reload => "reload",
});
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 {
Expand Down Expand Up @@ -143,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())))?
{
Expand Down

0 comments on commit 1e70637

Please sign in to comment.