From b59069552efdf6de5d124ab554e9b4ebae6e18f5 Mon Sep 17 00:00:00 2001 From: toyobayashi Date: Mon, 13 May 2024 21:39:52 +0800 Subject: [PATCH] dep --- packages/core/package.json | 4 ++-- packages/core/script/build.js | 10 +++++----- packages/emnapi/script/build.js | 2 +- packages/emnapi/src/core/init.ts | 2 +- packages/emnapi/src/core/scope.d.ts | 4 ++-- packages/runtime/package.json | 3 +-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 86931308..dcef87d0 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -23,11 +23,11 @@ }, "./dist/emnapi-core.min.mjs": { "types": "./dist/emnapi-core.d.mts", - "import": "./dist/emnapi-core.min.mjs", - "require": null + "default": "./dist/emnapi-core.min.mjs" } }, "dependencies": { + "@emnapi/wasi-threads": "1.0.0", "tslib": "^2.4.0" }, "scripts": { diff --git a/packages/core/script/build.js b/packages/core/script/build.js index a429e06f..99cb0bf8 100644 --- a/packages/core/script/build.js +++ b/packages/core/script/build.js @@ -108,7 +108,7 @@ function build () { } }, { - input: createInput(ts.ScriptTarget.ES2019, false, ['tslib']), + input: createInput(ts.ScriptTarget.ES2019, false, ['tslib', '@emnapi/wasi-threads']), output: { file: path.join(dist, 'emnapi-core.cjs.js'), format: 'cjs', @@ -118,7 +118,7 @@ function build () { } }, { - input: createInput(ts.ScriptTarget.ES2019, true, ['tslib']), + input: createInput(ts.ScriptTarget.ES2019, true, ['tslib', '@emnapi/wasi-threads']), output: { file: path.join(dist, 'emnapi-core.cjs.min.js'), format: 'cjs', @@ -128,7 +128,7 @@ function build () { } }, { - input: createInput(ts.ScriptTarget.ES2019, false, ['tslib']), + input: createInput(ts.ScriptTarget.ES2019, false, ['tslib', '@emnapi/wasi-threads']), output: { file: path.join(dist, 'emnapi-core.mjs'), format: 'esm', @@ -138,7 +138,7 @@ function build () { } }, { - input: createInput(ts.ScriptTarget.ES2019, true, ['tslib']), + input: createInput(ts.ScriptTarget.ES2019, true, ['tslib', '@emnapi/wasi-threads']), output: { file: path.join(dist, 'emnapi-core.min.mjs'), format: 'esm', @@ -148,7 +148,7 @@ function build () { } }, { - input: createInput(ts.ScriptTarget.ES5, false, ['tslib']), + input: createInput(ts.ScriptTarget.ES5, false, ['tslib', '@emnapi/wasi-threads']), output: { file: path.join(dist, 'emnapi-core.esm-bundler.js'), format: 'esm', diff --git a/packages/emnapi/script/build.js b/packages/emnapi/script/build.js index 358e8c3e..ba24e49c 100644 --- a/packages/emnapi/script/build.js +++ b/packages/emnapi/script/build.js @@ -129,7 +129,7 @@ async function build () { }) const parsedCode = compiler.parseCode(code) return `import { _WebAssembly as WebAssembly } from '@/util' -import * as wasiThreads from '@emnapi/wasi-threads' +import { ThreadManager } from '@emnapi/wasi-threads' export function createNapiModule (options) { ${parsedCode} diff --git a/packages/emnapi/src/core/init.ts b/packages/emnapi/src/core/init.ts index 543661ec..fc38a2f9 100644 --- a/packages/emnapi/src/core/init.ts +++ b/packages/emnapi/src/core/init.ts @@ -244,7 +244,7 @@ function emnapiAddSendListener (worker: any): boolean { napiModule.emnapi.addSendListener = emnapiAddSendListener -export var PThread = new wasiThreads.ThreadManager({ +export var PThread = new ThreadManager({ printErr: err, beforeLoad: (worker) => { emnapiAddSendListener(worker) diff --git a/packages/emnapi/src/core/scope.d.ts b/packages/emnapi/src/core/scope.d.ts index 7b2f2998..6e1f463e 100644 --- a/packages/emnapi/src/core/scope.d.ts +++ b/packages/emnapi/src/core/scope.d.ts @@ -15,7 +15,7 @@ declare interface CreateOptions { // factory parameter declare const options: CreateOptions -declare const wasiThreads: typeof import('../../../wasi-threads/lib/typings/index') - declare type ThreadManagerOptions = import('../../../wasi-threads/lib/typings/index').ThreadManagerOptions +declare const ThreadManager: typeof import('../../../wasi-threads/lib/typings/index').ThreadManager +// eslint-disable-next-line @typescript-eslint/no-redeclare declare type ThreadManager = import('../../../wasi-threads/lib/typings/index').ThreadManager diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 3f6acea4..4099f8da 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -23,8 +23,7 @@ }, "./dist/emnapi.min.mjs": { "types": "./dist/emnapi.d.mts", - "import": "./dist/emnapi.min.mjs", - "require": null + "default": "./dist/emnapi.min.mjs" } }, "dependencies": {