Repository navigation
feat(npm): add conditional Node.js and browser package entries - #119
google-labs-stitch[bot] wants to merge 5 commits into
Conversation
- Split src/index.ts into src/node.ts, src/browser.ts and src/shared.ts - Export conditional node and default entries and .wasm subpaths - Sanitize pkg/tunelet.d.ts in scripts/postbuild-wasm.mjs - Accept file: strings, cross-realm URLs and flat bundles in Node.js - Decode undefined HarmonyConfig.voices as 4 for strict TypeScript - Verify archive files, runtime loaders and four tsc profiles
|
Review: Conditional Node.js/browser exports are worth exploring if bundlers warn on node:fs/promises, but removing dist/index.js breaks documented bundler-free browser deployments, 'main' points to ./dist/browser.js, and WasmMemory is missing TS 7.0's toFixedLengthBuffer()/toResizableBuffer() methods. Let's land #123 first and revisit conditional exports as a backward-compatible follow-up that keeps dist/index.js and complete WasmMemory typing. |
- Restore src/index.ts for direct browser and main imports - Point main and types to dist/index.js and dist/index.d.ts - Export conditional browser and node entries in package.json - Add TypeScript 7.0 buffer methods to WasmMemory - Merge main into scripts/verify-pack.mjs for both archives - Check initializer object arguments in scripts/verify-pack.mjs
|
Updated this PR to make the conditional exports backward-compatible and synced with
|
|
Round 2 review: Thank you for restoring dist/index.js and completing TS 7.0 WasmMemory typing. However, scripts/postbuild-wasm.mjs and scripts/verify-pack.mjs still strip TuneletSymbol.dispose and forbid /// , which breaks TypeScript 'using' support. Since #123 already lands the .d.ts hygiene, { voices: undefined } fix, and .wasm exports while preserving Symbol.dispose via /// , please rebase onto #123, drop the duplicate postbuild-wasm.mjs / harmony.rs changes, and keep Symbol.dispose intact if we still want conditional Node/browser entries. |
- Merge main to use upstream postbuild-wasm.mjs and harmony.rs - Keep Tunelet[Symbol.dispose]() in verify-pack.mjs checks - Share isUrlLike across the browser, node and index entries - Check TypeScript 'using' disposal and HTTP Wasm loaders
|
Synced this PR with
|
|
Round 3 review: Approved — great work rebasing onto #123, dropping duplicate changes, and preserving TuneletSymbol.dispose with esnext.disposable. Please rebase onto updated main after #107 and #117 (keeping normalize-jsdoc.mjs chained in build:wasm and exporting TuneletAudioViews from the conditional entries). |
…de-browser-entries-jm0-60329ac7-4a9c-4ac8-a145-0cbb87778762 - Share TuneletAudioViews across node, browser and index entries - Keep normalize-jsdoc.mjs in build:wasm and clean dist in build:ts - Merge Float32, correction, JSDoc and prebuilt checks in verify-pack
|
Synced this PR with updated
|
|
Review: Conditional Please sync onto updated |
…de-browser-entries-jm0-60329ac7-4a9c-4ac8-a145-0cbb87778762 - Keep check:wasm in package.json and clean dist in build:ts - Keep Telemetry and ParameterControl checks in verify-pack.mjs - List browser, node and shared entries in README.md and AGENTS.md
|
Synced this PR with updated
|
Summary
src/node.tsandsrc/browser.tsentries alongside a sharedsrc/shared.tshelper while keepingsrc/index.ts(dist/index.jsanddist/index.d.ts) with identical exported signatures (includingTuneletAudioViews) for bundler-free browser deployments and"main"fallback."main": "./dist/index.js"and"types": "./dist/index.d.ts", and configure conditional"browser","node"and fallback package exports for"."inpackage.jsonon top ofmain.main'sscripts/postbuild-wasm.mjs,scripts/normalize-jsdoc.mjs,.githooks/*,.github/*,Cargo.lockand Rust sources unchanged soTunelet[Symbol.dispose](): void,TuneletAudioViews[Symbol.dispose](): void(/// <reference lib="esnext.disposable" />), TypeScript 7.0WasmMemorytyping, normalized JSDoc comments,.wasmsubpath exports,Float32buffers,humanize/flexTune,Telemetrypitch fields andFloat32Arrayvoice slices, scalarParameterControlevents and{ voices: undefined }handling stay intact without duplication."file:"URL strings and cross-realmURLobjects across entries, and resolvepkg/tunelet_bg.wasmfrom the installed package insrc/node.tsif../pkg/tunelet_bg.wasmis absent.AGENTS.md,README.mdandscripts/verify-pack.mjson top ofmainto documentsrc/browser.ts,src/node.ts,src/index.tsandsrc/shared.tsand verify bothtuneletand@bytelandtechnology/tuneletfourteen-file archives,--ignore-scriptsprebuilt checks,--out-dirchecksum output, browser bundle isolation,Tunelet[Symbol.dispose]()andTuneletAudioViews[Symbol.dispose]()withusingdisposal,Float32copied and in-place views,TelemetryandParameterControlruntime/type/JSDoc checks,dist/index.js,dist/node.jsanddist/browser.jsruntime and HTTP loaders, normalized JSDoc comments and strict TypeScript 7.0 profiles (node,es2023-bundler,es2023-nodenext,domandwebworker).Verification
cargo rustc --locked --lib --release -- -D warningsRUSTFLAGS="-D warnings" cargo build --locked --releasecargo fmt --checkcargo clippy --locked --lib -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --locked --no-depscargo rustdoc --locked --lib -- -D warningscargo package --lockednpm run check:wasmnpm run verify:pack -- --out-dir /tmp/verify-pack-out(sha256sum --check --strict) andnpm run build:ts && npm run verify:pack -- --ignore-scriptsAutomated PR initiated by user @byteland-app via Stitch Loop.