Skip to content

feat(codemod-rewrite-module-specifiers-to-full-paths): add debug logging and jsx/tsx support - #6

Merged
patricktree merged 2 commits into
mainfrom
feat/codemod-debug-and-jsx
Jul 29, 2026
Merged

feat(codemod-rewrite-module-specifiers-to-full-paths): add debug logging and jsx/tsx support#6
patricktree merged 2 commits into
mainfrom
feat/codemod-debug-and-jsx

Conversation

@patricktree

Copy link
Copy Markdown
Owner

Problem

The codemod has two gaps and one release hazard:

  • It cannot rewrite JSX sources. .jsx/.tsx files are parsed with the default parser, so module specifiers in those files are left untouched.
  • There is no way to see what it did. When a rewrite produces an unexpected result there is nothing to inspect short of diffing the output.
  • Its version field reads 2.0.3, but npm already carries 2.1.0 and 2.2.0 for this package, published on 2026-01-07. Releasing from this baseline would publish 2.0.4 — below the highest published version. npm points latest at whatever was published most recently, so that release would move latest backwards and hand consumers an older build. That is exactly what happened once already: 2.0.2 was published on 2026-04-27, after 2.2.0, and took over the tag.

Solution

Select the tsx parser for .jsx/.tsx files so JSX module specifiers are rewritten like any other, and add a --debug flag that emits structured diagnostic logs through OpenTelemetry.

Set the version baseline to 2.2.0, the highest version actually published, so the pending minor changeset lands on 2.3.0 and the next release stays above latest.

Details

  • feat(codemod-rewrite-module-specifiers-to-full-paths): add debug logging and jsx/tsx support
    • structured diagnostic logging behind a --debug flag (src/otel-logger.ts)
    • tsx parser selection for .jsx/.tsx sources, with input/output fixtures covering JSX and angle-bracket assertions
    • bump @commander-js/extra-typings, commander, jscodeshift, p-limit, @types/jscodeshift and ts-expose-internals
  • chore(codemod-rewrite-module-specifiers-to-full-paths): correct the version baseline to 2.2.0

Changesets

  • codemod-debug-logging.md — minor, the --debug flag
  • codemod-tsx-parser.md — patch, the parser selection
  • codemod-deps-bump.md — patch, the dependency bumps

Combined with the baseline correction, the next release is 2.3.0.

Validation

The codemod's fixture-based suite covers the new behavior: test/codemod-inputs and test/codemod-outputs gain a tsx-component.tsx and an angle-assertion.ts case, and cli-debug.spec.mts exercises the --debug path.

Ran:

  • pnpm install --frozen-lockfile — clean install from scratch
  • pnpm run validate — 26/26 tasks (build, lint, test) plus knip, all clean
  • pnpm run format:check — clean
  • pnpm exec changeset status — confirms the minor bump resolves to 2.3.0

Notes for the reviewer

  • The package deliberately keeps typescript@~5.9.3 as a runtime dependency: it consumes the compiler API and types itself against ts-expose-internals, which tracks TypeScript 5.x internals.
  • @patricktree/commons-ecma is not among the dependencies; knip reports it as unused here.

Written by @patricktree's agent (Claude Code, Opus 5).

patricktreeand others added 2 commits July 29, 2026 10:19
…ing and jsx/tsx support
- structured diagnostic logging via OpenTelemetry behind a `--debug` flag
(`src/otel-logger.ts`)
- select the `tsx` parser for `.jsx`/`.tsx` sources, so JSX module specifiers are
rewritten correctly, with fixtures covering it
- bump `@commander-js/extra-typings`, `commander`, `jscodeshift`, `p-limit`,
`@types/jscodeshift` and `ts-expose-internals`
Co-authored-by: patricktree-agents[bot] <2968297+patricktree-agents[bot]@users.noreply.github.com>
…ersion baseline to 2.2.0
npm already carries `2.1.0` and `2.2.0` for this package, published on 2026-01-07,
but the version field here still read `2.0.3`. Releasing from that baseline would
publish `2.0.4` - below the highest published version - which moves the `latest`
dist-tag backwards, exactly what happened when `2.0.2` was published after `2.2.0`.
Set the baseline to the highest published version so the pending minor changeset
lands on `2.3.0`.
Co-authored-by: patricktree-agents[bot] <2968297+patricktree-agents[bot]@users.noreply.github.com>
@patricktree
patricktree merged commit 087a1ac into mainJul 29, 2026
1 check passed
@patricktree
patricktree deleted the feat/codemod-debug-and-jsx branch July 29, 2026 08:25
Sign up for freeto 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

@patricktree