Skip to content

fix(cli): rewrite import extensions in transpile output - #36403

Open
rathodkunj2005 wants to merge 1 commit into
denoland:mainfrom
rathodkunj2005:fix/transpile-import-extensions
Open

fix(cli): rewrite import extensions in transpile output#36403
rathodkunj2005 wants to merge 1 commit into
denoland:mainfrom
rathodkunj2005:fix/transpile-import-extensions

Conversation

@rathodkunj2005

Copy link
Copy Markdown
Contributor

Closes #36399.

Summary

  • Rewrite TypeScript extensions in static imports, re-exports, and string-literal dynamic imports during deno transpile (.ts/.tsx.js, .mts.mjs, .cts.cjs).
  • Preserve query/hash suffixes, declaration-file specifiers, non-TypeScript specifiers, and ordinary string literals.
  • Add focused unit coverage for extension mapping and a spec regression covering static imports, re-exports, dynamic imports, and literal lookalikes.

Verification

  • cargo check -p deno
  • ./tools/format.js --check cli/tools/transpile.rs cli/tools/transpile/import_extensions.rs tests/specs/transpile/__test__.jsonc tests/specs/transpile/import_extensions.ts tests/specs/transpile/check_import_extensions.ts tests/specs/transpile/rewrite_import_extensions_emit.out
  • rustc --edition=2024 --test cli/tools/transpile/import_extensions.rs -o /tmp/import_extensions_test && /tmp/import_extensions_test (2 passed)

AI assistance was used to investigate the issue and implement this change; I reviewed the resulting code and tests.

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.

Deno transpile doesn't change import extensions from ".ts" to ".js"

1 participant