Skip to content

feat: v2 — modern rewrite, drop AMD/IE8 compat, dual CJS/ESM output#32

Merged
rgcl merged 5 commits into
mainfrom
v2
Jun 20, 2026
Merged

feat: v2 — modern rewrite, drop AMD/IE8 compat, dual CJS/ESM output#32
rgcl merged 5 commits into
mainfrom
v2

Conversation

@rgcl

@rgcl rgcl commented Jun 20, 2026

Copy link
Copy Markdown
Owner
  • Rewrite main.js -> index.js as plain CJS (drop AMD/UMD wrapper)
  • Add index.mjs ESM re-export for dual-module support
  • Add index.d.ts TypeScript declarations
  • Fix string deduplication bug: encode before dictionary lookup
  • Serialize Date as ISO 8601 string instead of producing {}
  • Use Array.isArray() directly, remove instanceof Array
  • Remove dead code: _indexOfDictionary, _indexOf IE8 polyfill
  • Dictionary uses objects for O(1) lookup (from merged PR Improve packing performance #27)
  • Replace Makefile + .travis.yml with npm scripts + GitHub Actions (Node 18/20/22)
  • Remove package.js (Dojo/Volo artifact)
  • Modernize package.json: license, repository URL, engines >=14, exports field
  • Migrate tests to assert.strict, drop expect.js, add Date and round-trip cases
  • Update all Sapienlab references to SASUD, update contact email
  • Rewrite README: remove Travis/volo/AMD, add ESM example, Web Worker note

rgcl added 5 commits June 19, 2026 23:29
- Rewrite main.js -> index.js as plain CJS (drop AMD/UMD wrapper)
- Add index.mjs ESM re-export for dual-module support
- Add index.d.ts TypeScript declarations
- Fix string deduplication bug: encode before dictionary lookup
- Serialize Date as ISO 8601 string instead of producing {}
- Use Array.isArray() directly, remove instanceof Array
- Remove dead code: _indexOfDictionary, _indexOf IE8 polyfill
- Dictionary uses objects for O(1) lookup (from merged PR #27)
- Replace Makefile + .travis.yml with npm scripts + GitHub Actions (Node 18/20/22)
- Remove package.js (Dojo/Volo artifact)
- Modernize package.json: license, repository URL, engines >=14, exports field
- Migrate tests to assert.strict, drop expect.js, add Date and round-trip cases
- Update all Sapienlab references to SASUD, update contact email
- Rewrite README: remove Travis/volo/AMD, add ESM example, Web Worker note
Reposition jsonpack as a URL-safe JSON serializer sitting between
encodeURIComponent (fast, expands data) and lz-string (best compression,
slow decode). Add benchmark charts, when-to-use guidance, and bundle size.
Add TOKEN_DATE (-6) to the packed format. During pack, Date instances
are stored as ISO strings in the dictionary and marked with a sentinel
in the structure section. During unpack, the sentinel triggers
new Date(dictionary[index]) restoring the original type.

Previously: pack({d: new Date()}) -> unpack -> {d: 'ISO string'}
Now:        pack({d: new Date()}) -> unpack -> {d: Date instance}

Old packed strings (without Date tokens) remain fully compatible.
@rgcl rgcl merged commit d42dc4b into main Jun 20, 2026
6 checks passed
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