Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update for deno_graph handling redirects #178

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 11,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install rust
uses: dsherret/rust-toolchain-file@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 20,7 @@ jobs:

steps:
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.DENOBOT_PAT }}

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 4,6 @@ es.zip
/npm
deno.lock
js/eszip_wasm_bg.wasm
js/eszip_wasm.generated.d.ts
js/eszip_wasm.generated.js
js/LICENSE
44 changes: 22 additions & 22 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 11,7 @@ license = "MIT"
members = ["lib"]

[workspace.dependencies]
deno_graph = "0.72.0"
deno_graph = "0.73.1"
import_map = "0.19.1"
serde = "1"

Expand All @@ -35,7 35,7 @@ path = "src/examples/viewer.rs"
[dependencies]
anyhow = "1"
base64 = "0.21.0"
deno_ast = { version = "0.37.0", features = ["transpiling"] }
deno_ast = { version = "0.37.1", features = ["transpiling"] }
deno_graph = { workspace = true }
deno_npm = "0.17.0"
deno_semver = "0.5.4"
Expand Down
2 changes: 1 addition & 1 deletion build_npm.ts
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
import { build, emptyDir } from "https://deno.land/x/dnt@0.40.0/mod.ts";
import { build, emptyDir } from "jsr:@deno/dnt@0.41.1";

await emptyDir("./npm");
Deno.mkdirSync("npm/esm", { recursive: true });
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
{
"tasks": {
"build": "cp LICENSE js/LICENSE && RUSTFLAGS=--cfg=web_sys_unstable_apis deno run -A https://deno.land/x/wasmbuild@0.15.6/main.ts --out js",
"build": "cp LICENSE js/LICENSE && RUSTFLAGS=--cfg=web_sys_unstable_apis deno run -A jsr:@deno/wasmbuild@0.17.1 --out js",
"node": "deno run -A ./build_npm.ts 0.0.0",
"test": "deno test -A js/",
"fmt": "deno fmt && cargo fmt --all"
Expand Down
4 changes: 2 additions & 2 deletions js/eszip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 3,8 @@
// CLI utility to build/list/extract/run ESZIPs

import { build, Parser } from "./mod.ts";
import { dirname, join } from "https://deno.land/std@0.127.0/path/mod.ts";
import { assertStrictEquals } from "https://deno.land/std@0.127.0/testing/asserts.ts";
import { dirname, join } from "jsr:@std/path@0.223";
import { assertStrictEquals } from "jsr:@std/assert@0.223";

function hasV2Header(bytes: Uint8Array) {
const magicV2 = new TextDecoder().decode(bytes.slice(0, 8));
Expand Down
4 changes: 2 additions & 2 deletions js/eszip_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 3,7 @@ import {
assert,
assertEquals,
assertRejects,
} from "https://deno.land/std@0.123.0/testing/asserts.ts";
} from "jsr:@std/assert@0.223";

Deno.test("roundtrip build parse", async () => {
const eszip = await build([
Expand Down Expand Up @@ -75,7 75,7 @@ Deno.test("loader errors", async () => {
["https://deno.land/[email protected]/fs/mod.ts"],
(specifier: string) => Promise.reject(new Error("oops")),
),
undefined,
Error,
"oops",
);
});
2 changes: 1 addition & 1 deletion js/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 3,4 @@ export type {
LoadResponse,
LoadResponseExternal,
LoadResponseModule,
} from "https://deno.land/x/deno_cache@0.7.1/mod.ts";
} from "jsr:@deno/cache-dir@0.8";
2 changes: 1 addition & 1 deletion js/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 6,7 @@ import {
import {
CacheSetting,
createCache,
} from "https://deno.land/x/deno_cache@0.7.1/mod.ts";
} from "jsr:@deno/cache-dir@0.8";
export type { LoadResponse } from "./loader.ts";

const encoder = new TextEncoder();
Expand Down
8 changes: 4 additions & 4 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 18,11 @@ deno_graph = { workspace = true, features = ["wasm_executor"] }
eszip = { path = "../" }
getrandom = { version = "*", features = ["js"] }
import_map = { workspace = true }
js-sys = { version = "0.3.64" }
js-sys = { version = "0.3.69" }
futures = "0.3.19"
wasm-bindgen = { version = "=0.2.90" }
wasm-bindgen-futures = { version = "=0.4.40" }
wasm-bindgen = { version = "=0.2.92" }
wasm-bindgen-futures = { version = "=0.4.42" }
serde = { workspace = true }
serde-wasm-bindgen = "0.5.0"
web-sys = { version = "=0.3.67", features = ["ReadableStreamByobReader"] }
web-sys = { version = "=0.3.69", features = ["ReadableStreamByobReader"] }

10 changes: 5 additions & 5 deletions lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 8,6 @@ use deno_graph::source::CacheInfo;
use deno_graph::source::LoadFuture;
use deno_graph::source::LoadOptions;
use deno_graph::source::Loader;
use deno_graph::source::NullFileSystem;
use deno_graph::source::ResolveError;
use deno_graph::source::Resolver;
use deno_graph::BuildOptions;
Expand Down Expand Up @@ -273,15 272,15 @@ pub async fn build_eszip(
let roots: Vec<deno_graph::ModuleSpecifier> =
serde_wasm_bindgen::from_value(roots)
.map_err(|e| js_sys::Error::new(&e.to_string()))?;
let mut loader = GraphLoader(loader);
let loader = GraphLoader(loader);
let import_map_url: Option<Url> =
serde_wasm_bindgen::from_value(import_map_url)
.map_err(|e| js_sys::Error::new(&e.to_string()))?;
let (maybe_import_map, maybe_import_map_data) = if let Some(import_map_url) =
import_map_url
{
let resp = deno_graph::source::Loader::load(
&mut loader,
&loader,
&import_map_url,
deno_graph::source::LoadOptions {
is_dynamic: false,
Expand Down Expand Up @@ -321,12 320,13 @@ pub async fn build_eszip(
graph
.build(
roots,
&mut loader,
&loader,
BuildOptions {
resolver: Some(&resolver),
module_analyzer: &analyzer,
is_dynamic: false,
imports: Vec::new(),
passthrough_jsr_specifiers: false,
executor: Default::default(),
file_system: Default::default(),
jsr_url_provider: Default::default(),
Expand Down Expand Up @@ -368,7 368,7 @@ impl Loader for GraphLoader {
}

fn load(
&mut self,
&self,
specifier: &ModuleSpecifier,
options: LoadOptions,
) -> LoadFuture {
Expand Down
8 changes: 4 additions & 4 deletions src/examples/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 23,11 @@ async fn main() {
let out = args.get(2).unwrap();
let maybe_import_map = args.get(3).map(|url| Url::parse(url).unwrap());

let mut loader = Loader;
let loader = Loader;
let (maybe_import_map, maybe_import_map_data) =
if let Some(import_map_url) = maybe_import_map {
let resp = deno_graph::source::Loader::load(
&mut loader,
&loader,
&import_map_url,
deno_graph::source::LoadOptions {
is_dynamic: false,
Expand Down Expand Up @@ -59,7 59,7 @@ async fn main() {
graph
.build(
vec![url],
&mut loader,
&loader,
BuildOptions {
resolver: Some(&Resolver(maybe_import_map)),
module_analyzer: &analyzer,
Expand Down Expand Up @@ -122,7 122,7 @@ struct Loader;

impl deno_graph::source::Loader for Loader {
fn load(
&mut self,
&self,
specifier: &deno_graph::ModuleSpecifier,
_options: deno_graph::source::LoadOptions,
) -> deno_graph::source::LoadFuture {
Expand Down
Loading
Loading