Skip to content

upgrade packages - #13

Merged
Ashniu123 merged 6 commits into
masterfrom
upgrade-packages-ts6-jest30-1
Aug 5, 2026
Merged

upgrade packages#13
Ashniu123 merged 6 commits into
masterfrom
upgrade-packages-ts6-jest30-1

Conversation

@Ashniu123

@Ashniu123 Ashniu123 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

upgrade ts to v6, jest to v30, @swc/* to latest and remove optionalDependencies. npm audit fix too

Jest 30 drops the legacy matcher aliases, so `toThrowError` becomes a
TypeError at runtime rather than a failed assertion. `toThrow` is the
same matcher and already works on Jest 29, so this lands safely ahead
of the upgrade.
…ependencies

Emitted output is byte-identical to TypeScript 5.5.3, verified by diffing a
full build before and after, so nothing changes for consumers of the
published package.

TypeScript 6:
  - `types` now defaults to [] instead of auto-including every package in
    node_modules/@types, so it has to be explicit. Without it the build
    fails on Buffer, URL, AbortController and the node: imports.
    tsconfig-build.json is deliberately narrower (node only) so Jest
    globals cannot leak into the published .d.ts.
  - moduleResolution "node" (node10) is no longer a valid value, not merely
    deprecated. Moved to module node20 + moduleResolution node16, which
    TypeScript requires as a pair (TS5109). Deliberately not nodenext,
    whose meaning shifts between releases; node20 has pinned semantics and
    matches engines.node >=22.
  - rootDir is no longer inferred from the input set (TS5011), so
    tsconfig-build.json sets it explicitly.

The resolution change needed no .js import extensions: there is no
"type": "module", so every file is CommonJS-mode, where extensionless
relative imports stay legal. The sole exception is the dynamic import in
the skipped ZoomClient test, because dynamic import() is always ESM-mode.
jest.config.js maps such specifiers back to their .ts sources so that test
remains runnable if it is ever unskipped.

@swc/*:
  optionalDependencies pinned 12 @swc/core-* platform binaries at 1.3.2
  while @swc/core resolved its own nested binaries at 1.9.3, so the pins
  were never loaded -- 152 MB of dead weight on this platform alone. They
  were also production deps, so every consumer of a package documented as
  zero-dependency downloaded them. The block dates to the initial commit
  with no rationale and had already drifted out of shape: it listed
  freebsd-x64, which SWC dropped, and omitted linux-arm-gnueabihf.

  @swc/core becomes an explicit devDependency. It was previously pinned
  only by the lockfile, floating on @swc/jest's `*` peer range.

husky:
  The pre-commit hook has never run. core.hooksPath was unset, .git/hooks
  held only samples, and there was no `prepare` script, so husky was never
  activated and .husky/pre-commit sat dead on disk. Adding `prepare` is
  what makes the gate exist at all. Confirmed with a real `git commit`
  rather than by running the hook script directly.

nock moves from a beta range to stable; ^14.0.0-beta.18 already resolved to
14.0.17, so this only makes the manifest honest.

The lockfile is regenerated rather than patched, because the old one still
recorded the 1.3.2 pins.
Each of these is invisible in the diff and cheap for a future dependency
bump to undo: explicit `types`, the node20/node16 pairing and why it is
not nodenext, explicit rootDir, the deliberately absent
optionalDependencies, and `prepare: husky` being the only reason the
pre-commit hook exists.

Also notes that Jest 30 removed the legacy matcher aliases, and how to
verify the hook is actually wired rather than merely present on disk.
It never resolved anything. The only relative .js specifier in the repo is
the dynamic import in a skipped ZoomClient test, so the mapping was inert
while still rewriting every relative .js specifier in the suite. Since
collectCoverageFrom already anticipates src/**/*.js, a real .js file would
have been silently redirected to a non-.js path.

The .js extension on that specifier stays: moduleResolution node16 requires
it on dynamic import(), which is always ESM-mode, and removing it fails
typecheck with TS2834. If that test is ever unskipped it will need the
mapping back, which CLAUDE.md now records.
Promotes 1.1.0-alpha.0 and 1.1.0-alpha.1 to stable. No API or behavior
change since alpha.1.

This is the first stable release of the 1.x line, so it is also the first
to carry 1.0.0's breaking changes -- 1.0.0 itself was never published, and
the newest stable version until now was 0.0.4. Publishing this moves the
npm `latest` tag from 0.0.4 to 1.1.0.

The one consumer-visible change from this branch is the removal of the dead
optionalDependencies block, which stops every install from downloading ~150 MB
of unused @swc/core native binaries.
The 0.x-to-1.0 mapping was a 26-line block in the middle of the Readme,
between "Code Generation" and "Contribution", read by almost nobody after
their first upgrade. Content moved verbatim; the Readme keeps a short
pointer to it.

Also fixes the now-stale "See README.md for detailed migration guide" line
in the 1.0.0 changelog entry.

MIGRATION.md is not in the published tarball, matching CHANGELOG.md -- the
Readme already links that the same relative way.
@Ashniu123
Ashniu123 merged commit ddcc423 into master Aug 5, 2026
4 checks passed
@Ashniu123
Ashniu123 deleted the upgrade-packages-ts6-jest30-1 branch August 5, 2026 10:35
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