Skip to content

Typedef fixes#15

Closed
kookster wants to merge 11 commits intomasterfrom
feat/typedef_fixes
Closed

Typedef fixes#15
kookster wants to merge 11 commits intomasterfrom
feat/typedef_fixes

Conversation

@kookster
Copy link
Copy Markdown
Member

I saw some other PRs for typedefs that weren't right and the typedefs for cart chunk and related other chunks were pretty vague, so this fixes those issues, and the export style - this obviously builds off PR #14 :

Bug:

  • toSampleRate(samples: number, ...) — parameter should be sampleRate, not samples

Chunk types are all object — these should have proper interfaces:

  • fact — has chunkId, chunkSize, dwSampleLength
  • cue — has chunkId, chunkSize, dwCuePoints, points (array of point objects)
  • smpl — has 12 fields plus loops array (each with 6 fields)
  • bext — has 17 fields (BWF metadata)
  • mext — has 7 fields (MPEG extension)
  • cart — has 22 fields including postTimer array
  • iXML, _PMX — have chunkId, chunkSize, value
  • ds64 — has 9 fields (RF64 size info)
  • junk — has chunkId, chunkSize, chunkData

Missing from fmt type:

  • MPEG fields (headLayer, headBitRate, headMode, headModeExt, headEmphasis, headFlags, ptsLow, ptsHigh) — should be optional

Return types too vague:

  • listTags() returns object — should be Record<string, string>
  • listCuePoints() returns Array — should have a CuePoint interface with all 15 fields

    Missing method:

    • getLISTIndex(listType: string): number | null — public method on WaveFileTagEditor

    Export style:

    • Uses export = wavefile / declare namespace (CJS-style). Now that the package has "type": "module" and ESM exports, this should use export class WaveFile instead.

kookster added 11 commits April 10, 2026 12:46
- Add "type": "module" to package.json for native ESM support
- Add .js extensions to all relative imports in lib/ and index.js
- Add nested package.json files in test/ and dist/ with "type": "commonjs"
  to keep CJS test files and UMD bundle working
- Replace esm package with Node 24's native require(esm) in test loader
- Upgrade mocha 6 -> 11, replace nyc with c8, upgrade typescript 3 -> 5
- Remove deprecated esm, codecov, and mocha-lcov-reporter packages
- Convert bin/wavefile.js to ESM imports
- Update engines field to >=18
- Add coverage/ to .gitignore
- Upgrade rollup ^1.27.14 -> ^4.0.0
- Upgrade @rollup/plugin-commonjs ^11.0.0 -> ^29.0.0
- Upgrade @rollup/plugin-node-resolve ^6.0.0 -> ^16.0.0
- Replace @ampproject/rollup-plugin-closure-compiler with @rollup/plugin-terser
- Remove ES3 class check from test loader (no longer transpiling to ES3)
- Bundle build time reduced from ~4.5s to ~450ms
- Remove externs/ directory (only used by Google Closure Compiler)
- Remove scripts/polyfills.js (IE10 Uint8Array.slice polyfill, no longer injected)
- Remove references to externs and scripts from package.json directories, files, and lint script
These configs tested against Node 8/9/10/12, which are all EOL.
Travis CI free tier for open source is also discontinued.
jsdoc 3.x depended on taffydb which has a known data access
vulnerability (GHSA-mxhp-79qh-mcx6). jsdoc 4.x drops this dependency.
Reduces npm audit vulnerabilities from 8 to 6.
Matches the modern ES syntax now used in the project.
docdash 1.x depended on taffydb (via jsdoc 3.x). Since jsdoc was
upgraded to 4.x which dropped taffydb, docdash needed to be upgraded
to 2.x which uses @jsdoc/salty instead.
The parameter was named 'samples' but should be 'sampleRate' to match
the actual implementation in wavefile-converter.js.
Replace generic 'object' types with specific interfaces for:
fact, cue, smpl, bext, mext, cart, iXML, ds64, LIST, junk, _PMX chunks.
Also adds sub-types for cue points, smpl loops, and cart post timers.
Adds MPEG fields (headLayer, headBitRate, etc.) to the fmt chunk type.
…uePoint

- listTags() now returns Record<string, string> instead of object
- listCuePoints() now returns CuePointOutput[] with all 15 fields typed
- setCuePoint() now accepts CuePointInput with required position and
  optional label, end, and region attributes
The package now uses "type": "module" with ESM exports, so the type
definitions should use 'export class' and 'export type' instead of
'export = wavefile' with 'declare namespace'. All types are now
individually exported so consumers can import them directly.
@kookster kookster closed this Apr 10, 2026
@kookster kookster deleted the feat/typedef_fixes branch April 10, 2026 17:47
@kookster kookster restored the feat/typedef_fixes branch April 10, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant