Two findings from the GitHub review bot on the ready PR: The tsdown two-entry build emitted the shared bootstrap module as a lib/bootstrap-*.js chunk imported by both bundles, which the package.json files whitelist (deliberately exact) omitted — a packed install had dangling imports. The package now runs two single-entry builds, so each bundle inlines its own bootstrap copy and every shipped file is self-contained. prepareValue admitted any cloneable value whose BOUNDED inspect rendering fit maxValueBytes, so a huge container with a compact rendering (a 50k-element array renders as '... N more items') crossed the port raw, bypassing the cap on both sides. The cap now measures the value's real cross-boundary size — exact bytes for strings, the structured-clone wire size (v8.serialize) for everything else — and oversized containers cross as their bounded rendering instead.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { defineConfig } from 'tsdown'
|
|
|
|
/**
|
|
* Package-shape override (see the root tsdown.config.ts): besides the
|
|
* default lib/index.js bundle, the worker BOOTSTRAP ships as its own
|
|
* sibling entry — `new Worker(new URL('./worker.js', import.meta.url))`
|
|
* loads it as a file, so it cannot be part of the index bundle. TWO
|
|
* single-entry builds, not one two-entry build: a multi-entry build emits
|
|
* the shared bootstrap module as a `lib/bootstrap-*.js` chunk both bundles
|
|
* import, which the package.json `files` whitelist (deliberately exact)
|
|
* would omit from the packed artifact — each single-entry build inlines its
|
|
* own bootstrap copy instead, keeping every shipped file self-contained.
|
|
*/
|
|
export default defineConfig([
|
|
{
|
|
entry: ['lib/types/index.js'],
|
|
outDir: 'lib',
|
|
format: ['esm'],
|
|
platform: 'node',
|
|
target: 'es2024',
|
|
fixedExtension: false,
|
|
dts: false,
|
|
clean: false,
|
|
},
|
|
{
|
|
entry: ['lib/types/worker.js'],
|
|
outDir: 'lib',
|
|
format: ['esm'],
|
|
platform: 'node',
|
|
target: 'es2024',
|
|
fixedExtension: false,
|
|
dts: false,
|
|
clean: false,
|
|
},
|
|
])
|