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

dev: update readAllSync #25

Merged
merged 2 commits into from
Sep 24, 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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ const wrapper: InstanceWrapper<Example> = new InstanceWrapper<Example>(example,
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
return Deno.readAllSync(fd);
//import { readAllSync } from 'https://deno.land/std/io/read_all.ts';
return readAllSync(fd);
},
});

Expand Down
12 changes: 6 additions & 6 deletions benchmark/wasm_instance_start_bench.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { InstanceWrapper, WorkerDefinition } from "../src/mod.ts";
import { existsSync } from "https://deno.land/std/fs/mod.ts";
import * as path from "https://deno.land/std@0.188.0/path/mod.ts";

import { readAllSync } from 'https://deno.land/std/io/read_all.ts';
class TestExample extends WorkerDefinition {
public constructor() {
super();
Expand Down Expand Up @@ -40,7 +40,7 @@ Deno.bench("Wasm Worker Start Go Module loading", {
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const mod = Deno.readAllSync(fd);
const mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down Expand Up @@ -74,7 +74,7 @@ Deno.bench("Wasm Worker Start Rust Module loading", {
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const mod = Deno.readAllSync(fd);
const mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down Expand Up @@ -116,7 +116,7 @@ Deno.bench("Wasm Worker Start Code Gen Bootstrapping Rust", {
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const mod = Deno.readAllSync(fd);
const mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down Expand Up @@ -162,7 +162,7 @@ Deno.bench("Wasm Worker Start Code Gen Bootstrapping Tiny Go", {
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const mod = Deno.readAllSync(fd);
const mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down Expand Up @@ -208,7 +208,7 @@ Deno.bench("Wasm Worker Start Code Gen Bootstrapping Go", {
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const mod = Deno.readAllSync(fd);
const mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down
8 changes: 7 additions & 1 deletion deno-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
}
},
"redirects": {
"https://deno.land/std/fs/mod.ts": "https://deno.land/std@0.211.0/fs/mod.ts"
"https://deno.land/std/fs/mod.ts": "https://deno.land/std@0.211.0/fs/mod.ts",
"https://deno.land/std/io/read_all.ts": "https://deno.land/std@0.224.0/io/read_all.ts",
"https://deno.land/std/io/read_all.ts?s=readAllSync": "https://deno.land/std@0.224.0/io/read_all.ts"
},
"remote": {
"https://deno.land/std@0.188.0/_util/asserts.ts": "178dfc49a464aee693a7e285567b3d0b555dc805ff490505a8aae34f9cfb1462",
Expand Down Expand Up @@ -125,6 +127,10 @@
"https://deno.land/std@0.211.0/path/windows/separator.ts": "2bbcc551f64810fb43252185bd1d33d66e0477d74bd52f03b89f5dc21a3dd486",
"https://deno.land/std@0.224.0/assert/assert.ts": "09d30564c09de846855b7b071e62b5974b001bb72a4b797958fe0660e7849834",
"https://deno.land/std@0.224.0/assert/assertion_error.ts": "ba8752bd27ebc51f723702fac2f54d3e94447598f54264a6653d6413738a8917",
"https://deno.land/std@0.224.0/bytes/concat.ts": "86161274b5546a02bdb3154652418efe7af8c9310e8d54107a68aaa148e0f5ed",
"https://deno.land/std@0.224.0/io/_constants.ts": "3c7ad4695832e6e4a32e35f218c70376b62bc78621ef069a4a0a3d55739f8856",
"https://deno.land/std@0.224.0/io/read_all.ts": "876c1cb20adea15349c72afc86cecd3573335845ae778967aefb5e55fe5a8a4a",
"https://deno.land/std@0.224.0/io/types.ts": "acecb3074c730b5ff487ba4fe9ce51e67bd982aa07c95e5f5679b7b2f24ad129",
"https://deno.land/std@0.224.0/path/_common/assert_path.ts": "dbdd757a465b690b2cc72fc5fb7698c51507dec6bfafce4ca500c46b76ff7bd8",
"https://deno.land/std@0.224.0/path/_common/basename.ts": "569744855bc8445f3a56087fd2aed56bdad39da971a8d92b138c9913aecc5fa2",
"https://deno.land/std@0.224.0/path/_common/common.ts": "ef73c2860694775fe8ffcbcdd387f9f97c7a656febf0daa8c73b56f4d8a7bd4c",
Expand Down
3 changes: 2 additions & 1 deletion examples/wasm/rust/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
WorkerDefinition,
} from "../../../src/InstanceWrapper.ts";
import { WorkerAny } from "../../../src/mod.ts";
import { readAllSync } from 'https://deno.land/std/io/read_all.ts';

class Example extends WorkerDefinition {
public constructor() {
Expand Down Expand Up @@ -32,7 +33,7 @@ const wrapper: InstanceWrapper<Example> = new InstanceWrapper<Example>(
modulePath: "./examples/wasm/rust/wasm_test_bg.wasm",
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
return Deno.readAllSync(fd);
return readAllSync(fd);
},
workerCount: 1,
},
Expand Down
3 changes: 2 additions & 1 deletion examples/wasm/tiny-go/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
WorkerDefinition,
} from "../../../src/InstanceWrapper.ts";
import type { WorkerAny } from "../../../src/types.ts";
import { readAllSync } from 'https://deno.land/std/io/read_all.ts';

class Example extends WorkerDefinition {
public constructor() {
Expand Down Expand Up @@ -37,7 +38,7 @@ const wrapper: InstanceWrapper<Example> = new InstanceWrapper<Example>(
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
return Deno.readAllSync(fd);
return readAllSync(fd);
},
workerCount: 5,
},
Expand Down
1 change: 1 addition & 0 deletions tests/instance_wrapper_static_generation_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as path from "https://deno.land/std@0.224.0/path/mod.ts";
import { InstanceWrapper, WorkerDefinition } from "../src/mod.ts";
import { existsSync } from "https://deno.land/std/fs/mod.ts";
import type { WorkerAny } from "../src/types.ts";
import { readAllSync } from 'https://deno.land/std/io/read_all.ts';

declare global {
const test: {
Expand Down
7 changes: 4 additions & 3 deletions tests/wasm_instance_wrapper_runtime_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as path from "https://deno.land/std@0.224.0/path/mod.ts";

import { InstanceWrapper, WorkerDefinition } from "../src/mod.ts";
import type { WorkerAny } from "../src/types.ts";
import { readAllSync } from 'https://deno.land/std/io/read_all.ts';

class GoTestExample extends WorkerDefinition {
public constructor() {
Expand Down Expand Up @@ -91,7 +92,7 @@ Deno.test("WASM Worker Should have wasm methods loaded from GoLang module", asyn
modulePath: wasmModPath,
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const mod = Deno.readAllSync(fd);
const mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down Expand Up @@ -145,7 +146,7 @@ Deno.test("WASM Worker method should correct pass arguments", async () => {
modulePath: wasmModPath,
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
let mod = Deno.readAllSync(fd);
let mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down Expand Up @@ -189,7 +190,7 @@ Deno.test("WASM Worker Should have wasm methods loaded from Rust compiled module
modulePath: wasmModPath,
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
let source = Deno.readAllSync(fd);
let source = readAllSync(fd);
fd.close();
return source;
},
Expand Down
9 changes: 5 additions & 4 deletions tests/wasm_instance_wrapper_standup_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
import * as path from "https://deno.land/std@0.224.0/path/mod.ts";
import { InstanceWrapper, WorkerDefinition } from "../src/InstanceWrapper.ts";
import type { WorkerAny } from "../src/types.ts";
import { readAllSync } from 'https://deno.land/std/io/read_all.ts';

class TestExample extends WorkerDefinition {
public constructor() {
Expand Down Expand Up @@ -40,7 +41,7 @@ Deno.test("Wasm Worker Wrapper manager should have config correctly defnined", (
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const mod = Deno.readAllSync(fd);
const mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down Expand Up @@ -74,7 +75,7 @@ Deno.test("Wasm class members should be defined", () => {
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const mod = Deno.readAllSync(fd);
const mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down Expand Up @@ -107,7 +108,7 @@ Deno.test("Wasm class should have correct worker number on start", () => {
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const mod = Deno.readAllSync(fd);
const mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down Expand Up @@ -141,7 +142,7 @@ Deno.test("Wasm class ", () => {
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const mod = Deno.readAllSync(fd);
const mod = readAllSync(fd);
fd.close();
return mod;
},
Expand Down
3 changes: 2 additions & 1 deletion tests/wasm_instance_wrapper_static_generation_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as path from "https://deno.land/std@0.224.0/path/mod.ts";

import { InstanceWrapper, WorkerDefinition } from "../src/mod.ts";
import { existsSync } from "https://deno.land/std@0.211.0/fs/exists.ts";
import { readAllSync } from 'https://deno.land/std/io/read_all.ts';

import type { WorkerAny } from "../src/types.ts";

Expand Down Expand Up @@ -69,7 +70,7 @@ Deno.test("WASM Worker Should generate worker and load functions into global", a
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
const source = Deno.readAllSync(fd);
const source = readAllSync(fd);
fd.close();
return source;
},
Expand Down
Loading