feat(demo, docs): introduce threading test demos for browser and fallback, enhance threading documentation
- Added `test-browser-worker.html` to demonstrate threading with Web Workers in browser environments. - Added `test-fallback.html` to verify fallback functionality when threading is unavailable. - Created `THREADING.md` to document unified threading implementation, including Node.js Worker Threads, Web Workers, and fallback mechanisms. - Updated Node.js version requirement in `README.md` and `package.json` to `>=24.0.0` for compatibility with improved Worker Threads API. - Enhanced `workerUtils.ts` to implement threading with a worker pool for Node.js and added Web Worker execution logic for browsers. - Enabled environment-aware threading availability in `environment.ts`. - Updated `rollup.config.js` to include CLI configurations for streamlined builds. - Adjusted `.gitignore` to exclude test artifacts and package files. These changes provide comprehensive testing and documentation of threading functionality, improve cross-environment compatibility, and enhance developer workflows.
This commit is contained in:
parent
f64589b559
commit
de627c5dfa
10 changed files with 664 additions and 21 deletions
|
|
@ -112,6 +112,14 @@ const config = {
|
|||
var global = typeof window !== "undefined" ? window : this;
|
||||
// Buffer polyfill is now included via the buffer-polyfill plugin
|
||||
`
|
||||
},
|
||||
cli: {
|
||||
input: 'src/cli.ts',
|
||||
outputPrefix: 'cli',
|
||||
tsconfig: './tsconfig.unified.json',
|
||||
declaration: false,
|
||||
declarationMap: false,
|
||||
intro: ''
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +127,7 @@ var global = typeof window !== "undefined" ? window : this;
|
|||
const buildConfig = config[buildType]
|
||||
|
||||
// Create the rollup configuration
|
||||
export default {
|
||||
const mainConfig = {
|
||||
input: buildConfig.input,
|
||||
output: [
|
||||
{
|
||||
|
|
@ -174,6 +182,51 @@ export default {
|
|||
'@smithy/util-stream',
|
||||
'@smithy/node-http-handler',
|
||||
'@aws-crypto/crc32c',
|
||||
'node:stream/web'
|
||||
'node:stream/web',
|
||||
'node:worker_threads'
|
||||
]
|
||||
}
|
||||
|
||||
// CLI configuration
|
||||
const cliConfig = {
|
||||
input: 'src/cli.ts',
|
||||
output: {
|
||||
dir: 'dist',
|
||||
entryFileNames: 'cli.js',
|
||||
format: 'es',
|
||||
sourcemap: true,
|
||||
inlineDynamicImports: true
|
||||
},
|
||||
plugins: [
|
||||
replace({
|
||||
preventAssignment: true,
|
||||
'process.env.NODE_ENV': JSON.stringify('production')
|
||||
}),
|
||||
fixThisReferences(),
|
||||
resolve({
|
||||
browser: false,
|
||||
preferBuiltins: true
|
||||
}),
|
||||
commonjs({
|
||||
transformMixedEsModules: true
|
||||
}),
|
||||
json(),
|
||||
typescript({
|
||||
tsconfig: './tsconfig.unified.json',
|
||||
declaration: false,
|
||||
declarationMap: false
|
||||
})
|
||||
],
|
||||
external: [
|
||||
// Add any dependencies you want to exclude from the bundle
|
||||
'@aws-sdk/client-s3',
|
||||
'@smithy/util-stream',
|
||||
'@smithy/node-http-handler',
|
||||
'@aws-crypto/crc32c',
|
||||
'node:stream/web',
|
||||
'node:worker_threads'
|
||||
]
|
||||
}
|
||||
|
||||
// Export both configurations
|
||||
export default [mainConfig, cliConfig]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue