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

Worker bundle #70

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ set_target_properties(hdf5_util PROPERTIES
-s ENVIRONMENT=web,worker \
-s SINGLE_FILE \
-s EXPORT_ES6=1 \
-s USE_ES6_IMPORT_META=0 \
-s FORCE_FILESYSTEM=1 \
-s EXPORTED_RUNTIME_METHODS=\"['ccall', 'cwrap', 'FS', 'AsciiToString', 'UTF8ToString']\" \
-s EXPORTED_FUNCTIONS=\"${EXPORTED_FUNCTIONS_STRING}\""
Expand Down
15 changes: 15 additions & 0 deletions build_worker_bundle.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as esbuild from 'esbuild';
import inlineWorkerPlugin from 'esbuild-plugin-inline-worker';

const extraConfig = {
target: 'es2020',
format: 'esm',
};

await esbuild.build({
entryPoints: ['src/worker_proxy.ts'],
bundle: true,
format: 'esm',
outfile: 'dist/worker/worker_proxy_bundle.js',
plugins: [inlineWorkerPlugin(extraConfig)],
});
253 changes: 253 additions & 0 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"build_node": "tsc src/hdf5_hl.ts --outDir dist/node --target es2020 --allowJs --esModuleInterop",
"build_iife": "esbuild --bundle dist/esm/hdf5_hl.js --outfile=dist/iife/h5wasm.js --format=iife --global-name=h5wasm",
"build_types": "tsc --declaration --strict --emitDeclarationOnly src/hdf5_hl.ts --target es2020",
"build_worker_bundle": "node build_worker_bundle.mjs",
"test": "node ./test/test.mjs"
},
"repository": {
Expand All @@ -39,7 +40,9 @@
"author": "Brian B. Maranville",
"license": "SEE LICENSE IN LICENSE.txt",
"devDependencies": {
"comlink": "^4.4.1",
"esbuild": "^0.15.16",
"esbuild-plugin-inline-worker": "^0.1.1",
"typescript": "^4.5.4"
}
}
Loading
Loading