Skip to content

feat: convert lib/ JavaScript to TypeScript (behavior-identical) - #436

Merged
Dexus merged 10 commits into
masterfrom
worktree-ts-conversion
Nov 5, 2026
Merged

Dexus merged 10 commits into
masterfrom
worktree-ts-conversion

Conversation

@Dexus

@Dexus Dexus commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Converts all six lib/ modules from JavaScript to TypeScript under the hard requirement "works exact like the JavaScript now" — every emitted .js is runtime-identical to the previous JS, verified at four independent layers.

What changed

  • lib/debug.ts, lib/helper.ts, lib/openssl.ts (+ lib/which.d.ts sidecar — which@7 ships no types), lib/convert.ts, lib/pem.ts, lib/ca.ts
  • tsconfig.json: rootDir-only, emit-beside-source (tsc -p .); lib/*.js is gitignored build output now (zero tracked)
  • eslint config widened for the TS sources (rule scoping preserves untouched test/markdown lint behavior)
  • package.json: build now chains build:lib before ncc — fixes release-v2.yml on fresh checkouts; dist/ bundle rebuilt and committed (byte-reproducible, see verification)
  • test/ and types/ are byte-identical to master — the 133-test suite and tsd type tests are the same acceptance criteria as before

Behavior-parity decisions (rules R1–R17, learned and applied during conversion)

  • Export scheme per file matched to master's own assignment shape; V8 .name semantics preserved (anonymous "" names master relies on)
  • No live __esModule marker on any module: pem.ts stays script-form so import pem from 'pem' default-import interop keeps working; convert.ts is module-form with a dead marker (replaced exports)
  • pem↔ca circular require ordering intact (createCSR assigned before module.exports.CA = require('./ca'))
  • Master's comment inventory survives emit (incl. the GHSA-445w-cp49-3x4p security note in ca)

Verification

  • Whole-branch gate (14 items): lint · 133 tests · tsd · ncc build + bundle smoke-load · api-surface equality vs master (keys, .name, arities, CertificateAuthority shape) · git-state asserts · diff-paths · test/types untouched
  • Token-level emit parity: normalized AST diff of emitted pem.js/ca.js vs master is empty except require paths and erased-cast parens
  • Fresh-clone simulation: clone → yarn install --immutable → yarn run build → smoke PASS; rebuilt dist/ byte-identical to the committed bundle
  • Publish path: both npm 11 and yarn 4.18.1 packers verified to include compiled lib/*.js despite the gitignore (files whitelist force-includes)
  • Independent whole-branch review: Ready to merge, 0 Critical / 0 Important; 3 documentation-level findings adjudicated (R9 exception recorded, R17 strict-mode rule added, one release-checklist note: confirm lib/*.js in the yarn npm publish --dry-run tarball list)

Notes

  • Toolchain pins: typescript 5.9.3 (npm-latest 7.x removed node10 moduleResolution and breaks typescript-eslint)
  • Tarball now also ships lib/*.ts sources (same-as-master-or-better; types/pem.test-d.ts shipped on master too)
  • Release checklist: confirm lib/*.js appear in the printed yarn npm publish --dry-run tarball list (both current packers verified)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T19:37:37.932190Z a40dd60 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Dexus
Dexus merged commit cc5d2b2 into master Nov 5, 2026
202 of 203 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