From dd748e8a8fb5e19ed48d65687cc7d8f5edca66c9 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 31 Jan 2024 10:09:35 -0500 Subject: [PATCH] Maybe fix --- deno.json | 2 +- js/mod.ts | 2 +- js/test.ts | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/deno.json b/deno.json index dfe8a4bc4..9e652829b 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "tasks": { - "build": "cp LICENSE js/LICENSE && deno run --unstable -A --no-check https://deno.land/x/wasmbuild@0.15.1/main.ts --no-default-features --project deno_graph_wasm --out js", + "build": "cp LICENSE js/LICENSE && deno run -A --no-check https://deno.land/x/wasmbuild@0.15.1/main.ts --no-default-features --project deno_graph_wasm --out js", "build:npm": "deno run -A _build_npm.ts", "test": "deno test --allow-read --allow-net" }, diff --git a/js/mod.ts b/js/mod.ts index 4435c166a..38266446d 100644 --- a/js/mod.ts +++ b/js/mod.ts @@ -192,7 +192,7 @@ export async function init(opts?: wasm.InstantiateOptions) { */ export function parseModule( specifier: string, - content: string, + content: Uint8Array, options: ParseModuleOptions = {}, ): ModuleJson { const { diff --git a/js/test.ts b/js/test.ts index 32b015277..fea01259c 100644 --- a/js/test.ts +++ b/js/test.ts @@ -538,13 +538,13 @@ Deno.test({ await init(); const module = parseModule( "file:///a/test01.js", - ` + new TextEncoder().encode(` /// import { a } from "./a.ts"; import * as b from "./b.ts"; export { c } from "./c.ts"; const d = await import("./d.ts"); - `, + `), ); assertEquals(module, { "specifier": "file:///a/test01.js", @@ -609,9 +609,9 @@ Deno.test({ await init(); const module = parseModule( `https://example.com/a`, - `declare interface A { + new TextEncoder().encode(`declare interface A { a: string; - }`, + }`), { headers: { "content-type": "application/typescript; charset=utf-8", @@ -628,10 +628,10 @@ Deno.test({ await init(); const module = parseModule( `file:///a/test01.tsx`, - `/* @jsxImportSource http://example.com/preact */ + new TextEncoder().encode(`/* @jsxImportSource http://example.com/preact */ export function A() {
Hello Deno
- }`, + }`), { jsxImportSourceModule: "jsx-dev-runtime", }, @@ -651,10 +651,10 @@ Deno.test({ await init(); const module = parseModule( `file:///a/test01.tsx`, - ` + new TextEncoder().encode(` export function A() {
Hello Deno
- }`, + }`), { defaultJsxImportSource: "http://example.com/preact", }, @@ -673,7 +673,7 @@ Deno.test({ await init(); assertThrows( () => { - parseModule("./bad.ts", `console.log("hello");`); + parseModule("./bad.ts", new TextEncoder().encode(`console.log("hello");`)); }, Error, "relative URL without a base", @@ -687,7 +687,7 @@ Deno.test({ await init(); assertThrows( () => { - parseModule("file:///a/test.md", `# Some Markdown\n\n**bold**`); + parseModule("file:///a/test.md", new TextEncoder().encode(`# Some Markdown\n\n**bold**`)); }, Error, "The module's source code could not be parsed", @@ -701,10 +701,10 @@ Deno.test({ await init(); const module = parseModule( "file:///a/test01.js", - ` + new TextEncoder().encode(` import a from "./a.json" with { type: "json" }; await import("./b.json", { with: { type: "json" } }); - `, + `), ); assertEquals(module, { "dependencies": [ @@ -758,10 +758,10 @@ Deno.test({ await init(); const module = parseModule( "file:///a/foo.ts", - ` + new TextEncoder().encode(` /// /// - `, + `), ); assertEquals(module, { "dependencies": [