Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Commit ab172f9

Browse files
committed
fix: updated dist folder and some fixes for running lint
1 parent 41e390b commit ab172f9

31 files changed

+110
-56
lines changed

packages/duckdb-wasm/dist/duckdb-browser-blocking.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-browser-blocking.cjs.map

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-browser-blocking.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-browser-blocking.mjs.map

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-browser-coi.worker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/duckdb-wasm/dist/duckdb-browser-coi.worker.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/duckdb-wasm/dist/duckdb-browser-eh.worker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/duckdb-wasm/dist/duckdb-browser-eh.worker.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/duckdb-wasm/dist/duckdb-browser-mvp.worker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/duckdb-wasm/dist/duckdb-browser-mvp.worker.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/duckdb-wasm/dist/duckdb-browser.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-browser.cjs.map

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-browser.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-browser.mjs.map

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-node-blocking.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-node-blocking.cjs.map

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-node-eh.worker.cjs.map

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-node-mvp.worker.cjs.map

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-node.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/duckdb-node.cjs.map

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/tests-browser.js

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20445,7 +20445,7 @@ return true;`);
2044520445
throw new Error(`WASM instantiation requested unexpected file: prefix=${prefix} path=${path}`);
2044620446
}
2044720447
/** Instantiate the wasm module */
20448-
instantiateWasm(imports, success) {
20448+
async instantiateWasm(imports, success) {
2044920449
globalThis.DUCKDB_RUNTIME = this._runtime;
2045020450
const handlers = this.onInstantiationProgress;
2045120451
if (WebAssembly.instantiateStreaming) {
@@ -20481,15 +20481,43 @@ return true;`);
2048120481
return new Response(response2.body?.pipeThrough(ts), response2);
2048220482
};
2048320483
const response = fetchWithProgress();
20484-
WebAssembly.instantiateStreaming(response, imports).then((output) => {
20485-
success(output.instance, output.module);
20486-
});
20484+
const initiateStreaming = async () => {
20485+
try {
20486+
const output = await WebAssembly.instantiateStreaming(response, imports);
20487+
success(output.instance, output.module);
20488+
} catch (error) {
20489+
this.logger.log({
20490+
timestamp: /* @__PURE__ */ new Date(),
20491+
level: 4 /* ERROR */,
20492+
origin: 3 /* BINDINGS */,
20493+
topic: 5 /* INSTANTIATE */,
20494+
event: 2 /* ERROR */,
20495+
value: "Failed to instantiate WASM: " + error
20496+
});
20497+
throw error;
20498+
}
20499+
};
20500+
await initiateStreaming();
2048720501
} else {
2048820502
console.warn("instantiating without progress handler since transform streams are unavailable");
2048920503
const request = new Request(this.mainModuleURL);
20490-
WebAssembly.instantiateStreaming(fetch(request), imports).then((output) => {
20491-
success(output.instance, output.module);
20492-
});
20504+
const initiateStreaming = async () => {
20505+
try {
20506+
const output = await WebAssembly.instantiateStreaming(fetch(request), imports);
20507+
success(output.instance, output.module);
20508+
} catch (error) {
20509+
this.logger.log({
20510+
timestamp: /* @__PURE__ */ new Date(),
20511+
level: 4 /* ERROR */,
20512+
origin: 3 /* BINDINGS */,
20513+
topic: 5 /* INSTANTIATE */,
20514+
event: 2 /* ERROR */,
20515+
value: "Failed to instantiate WASM: " + error
20516+
});
20517+
throw error;
20518+
}
20519+
};
20520+
await initiateStreaming();
2049320521
}
2049420522
} else if (typeof XMLHttpRequest == "function") {
2049520523
const xhr = new XMLHttpRequest();
@@ -20582,12 +20610,26 @@ return true;`);
2058220610
super(logger, runtime, mainModuleURL, pthreadWorkerURL);
2058320611
}
2058420612
/** Instantiate the bindings */
20585-
instantiateImpl(moduleOverrides) {
20586-
return (0, import_duckdb_eh.default)({
20587-
...moduleOverrides,
20588-
instantiateWasm: this.instantiateWasm.bind(this),
20589-
locateFile: this.locateFile.bind(this)
20590-
});
20613+
async instantiateImpl(moduleOverrides) {
20614+
try {
20615+
const wasm = this.instantiateWasm.bind(this);
20616+
const locateFile = this.locateFile.bind(this);
20617+
return await (0, import_duckdb_eh.default)({
20618+
...moduleOverrides,
20619+
instantiateWasm: wasm,
20620+
locateFile
20621+
});
20622+
} catch (error) {
20623+
this.logger.log({
20624+
timestamp: /* @__PURE__ */ new Date(),
20625+
level: 4 /* ERROR */,
20626+
origin: 3 /* BINDINGS */,
20627+
topic: 5 /* INSTANTIATE */,
20628+
event: 2 /* ERROR */,
20629+
value: "Failed to instantiate WASM: " + error
20630+
});
20631+
throw error;
20632+
}
2059120633
}
2059220634
};
2059320635

packages/duckdb-wasm/dist/tests-browser.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/duckdb-wasm/dist/tests-node.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13596,6 +13596,7 @@ var DuckDBNodeBindings = class extends DuckDBBindingsBase {
1359613596
instantiateImpl(moduleOverrides) {
1359713597
return (0, import_duckdb_mvp.default)({
1359813598
...moduleOverrides,
13599+
//@ts-ignore
1359913600
instantiateWasm: this.instantiateWasm.bind(this)
1360013601
});
1360113602
}
@@ -13611,6 +13612,7 @@ var DuckDB = class extends DuckDBNodeBindings {
1361113612
instantiateImpl(moduleOverrides) {
1361213613
return (0, import_duckdb_mvp2.default)({
1361313614
...moduleOverrides,
13615+
//@ts-ignore
1361413616
instantiateWasm: this.instantiateWasm.bind(this),
1361513617
locateFile: this.locateFile.bind(this)
1361613618
});
@@ -13628,6 +13630,7 @@ var DuckDB2 = class extends DuckDBNodeBindings {
1362813630
instantiateImpl(moduleOverrides) {
1362913631
return (0, import_duckdb_eh.default)({
1363013632
...moduleOverrides,
13633+
//@ts-ignore
1363113634
instantiateWasm: this.instantiateWasm.bind(this),
1363213635
locateFile: this.locateFile.bind(this)
1363313636
});

packages/duckdb-wasm/dist/tests-node.cjs.map

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

packages/duckdb-wasm/dist/types/src/bindings/bindings_browser_base.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export declare abstract class DuckDBBrowserBindings extends DuckDBBindingsBase {
1414
/** Locate a file */
1515
protected locateFile(path: string, prefix: string): string;
1616
/** Instantiate the wasm module */
17-
protected instantiateWasm(imports: any, success: (instance: WebAssembly.Instance, module: WebAssembly.Module) => void): Emscripten.WebAssemblyExports;
17+
protected instantiateWasm(imports: any, success: (instance: WebAssembly.Instance, module: WebAssembly.Module) => void): Promise<Emscripten.WebAssemblyExports>;
1818
protected abstract instantiateImpl(moduleOverrides: Partial<DuckDBModule>): Promise<DuckDBModule>;
1919
}

packages/duckdb-wasm/dist/types/src/bindings/duckdb_module.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ export interface DuckDBModule extends EmscriptenModule {
99
stackRestore: typeof stackRestore;
1010
ccall: typeof ccall;
1111
PThread: PThread;
12+
instantiateWasm: (imports: Emscripten.WebAssemblyImports, successCallback: (module: WebAssembly.Module) => void) => Promise<Emscripten.WebAssemblyExports>;
1213
}

packages/duckdb-wasm/src/bindings/bindings_browser_base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export abstract class DuckDBBrowserBindings extends DuckDBBindingsBase {
3838
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
3939
imports: any,
4040
success: (instance: WebAssembly.Instance, module: WebAssembly.Module) => void,
41-
): Emscripten.WebAssemblyExports {
41+
): Promise<Emscripten.WebAssemblyExports> {
4242
// We rely on the following here:
4343
//
4444
// ...when a Request object is created using the Request.Request constructor,

packages/duckdb-wasm/src/bindings/bindings_node_base.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class DuckDBNodeBindings extends DuckDBBindingsBase {
4444
}
4545

4646
/** Instantiate the wasm module */
47-
protected instantiateWasm(
47+
protected instantiateWasm(
4848
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
4949
imports: any,
5050
success: (instance: WebAssembly.Instance, module: WebAssembly.Module) => void,
@@ -65,6 +65,7 @@ export class DuckDBNodeBindings extends DuckDBBindingsBase {
6565
protected instantiateImpl(moduleOverrides: Partial<DuckDBModule>): Promise<DuckDBModule> {
6666
return DuckDBWasm({
6767
...moduleOverrides,
68+
//@ts-ignore
6869
instantiateWasm: this.instantiateWasm.bind(this),
6970
});
7071
}

packages/duckdb-wasm/src/bindings/bindings_node_eh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class DuckDB extends DuckDBNodeBindings {
2020
protected instantiateImpl(moduleOverrides: Partial<DuckDBModule>): Promise<DuckDBModule> {
2121
return DuckDBWasm({
2222
...moduleOverrides,
23+
//@ts-ignore
2324
instantiateWasm: this.instantiateWasm.bind(this),
2425
locateFile: this.locateFile.bind(this),
2526
});

packages/duckdb-wasm/src/bindings/bindings_node_mvp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class DuckDB extends DuckDBNodeBindings {
2020
protected instantiateImpl(moduleOverrides: Partial<DuckDBModule>): Promise<DuckDBModule> {
2121
return DuckDBWasm({
2222
...moduleOverrides,
23+
//@ts-ignore
2324
instantiateWasm: this.instantiateWasm.bind(this),
2425
locateFile: this.locateFile.bind(this),
2526
});

packages/duckdb-wasm/src/bindings/duckdb_module.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@ export interface PThread {
33
runningWorkers: Worker[];
44
}
55

6+
// @ts-ignore - We are trying to fix some thing using the below code
67
export interface DuckDBModule extends EmscriptenModule {
78
stackSave: typeof stackSave;
89
stackAlloc: typeof stackAlloc;
910
stackRestore: typeof stackRestore;
1011

1112
ccall: typeof ccall;
1213
PThread: PThread;
14+
instantiateWasm: (
15+
imports: Emscripten.WebAssemblyImports,
16+
successCallback: (module: WebAssembly.Module) => void,
17+
) => Promise<Emscripten.WebAssemblyExports>;
1318
}

0 commit comments

Comments
 (0)