Skip to content

Keep the extension of remote transform URLs with a query string - #744

Open
kwy404 wants to merge 1 commit into
meta:mainfrom
kwy404:fix-remote-transform-extension
Open

kwy404 wants to merge 1 commit into
meta:mainfrom
kwy404:fix-remote-transform-extension

Conversation

@kwy404

@kwy404 kwy404 commented Sep 24, 2026

Copy link
Copy Markdown

Summary

When the transform is a URL, the temporary file gets its extension from path.extname of the whole URL, so https://host/transform.ts?token=abc gives .ts?token=abc. The transform is then not treated as TypeScript and fails to load with SyntaxError: Cannot use import statement outside a module. This takes the extension from the URL pathname instead.

Fixes #552

Test Plan

Added a CLI test that serves a TypeScript transform from a local HTTP server at /transform.ts?token=abc. It fails on main (the source file is left unchanged) and passes with this change. yarn test shows no other new failures. A patch changeset is included.

The temporary file for a remote transform took its extension from the
whole URL, so a URL like `https://host/transform.ts?token=abc` produced
the extension `.ts?token=abc`. The transform was then not recognized as
TypeScript and failed to load. Use the extension of the URL pathname
instead.

Fixes meta#552
@changeset-bot

changeset-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7e42061

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
jscodeshift Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Sep 24, 2026

Copy link
Copy Markdown

@kwy404 is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@meta-cla meta-cla Bot added the CLA Signed label Sep 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URL transform doesn't work with TypeScript

1 participant