You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a wrapper migration to orchestrate individual sub-migrations (eg inline require()s → await import()orimport.sync() depending on parent context being sync or async).
This wrapper should handle:
Running individual API migrations
Update files using CJS-specific extension (.cjs → .mjs, etc).
IMO we shouldn't touch to typescript file for the first iteration.
FYI: i have opened a pr as draft to make some research about the good way to handle that #340
Also If we change the extension we will need to update some other part of the codebase which mean we need a way to track/store that.
In term of technical part we:
want to have step by step thing not one jssg workflow
doesn't want to have one big pr with +50K
🚨IMPORTANT 🚨
I'm going to have a call today with codemod.com team to discuss about technical part. And with theses information I'm going to make an action plan.
Also If we change the extension we will need to update some other part of the codebase which mean we need a way to track/store that.
I accounted for that in the relevant sub-tickets 🙂 correct-ts-specifiers can handle that (just run it after the file extensions are changed—it should work for vanilla js extensions too; if it doesn't, it probably easily could).
I just realised correct-ts-specifiers needs an update to also handle node:test's mock.module.
having mutilple pr that setup the tests suite without running it. (yeah test driving development here)
Adding one codemod by pr + running there test
publish the codemod
Technical constraint, if we modify file ext we will need to store data (from/to) somewhere. It's will be stored in state which is not available on steps that are Codemod Registry Step we will only use jssg step. So what it's implied for the user it's mean the user will just be able to run @nodejs/cjs-to-esm and not each step as independent thing.
We can still block the user with manual step
it's mean the user will just be able to run @nodejs/cjs-to-esm and not each step as independent thing
I think that's not necessarily true: they can run the individual steps, but they can't automatically update file extensions (which they may not even need to do). No?
it's mean the user will just be able to run @nodejs/cjs-to-esm and not each step as independent thing
I think that's not necessarily true: they can run the individual steps, but they can't automatically update file extensions (which they may not even need to do). No?
Saddly if we want to harmonize everything on use codebase we need to update ext to js + update package.json type key. To not have to do some intensive fs call to verify all import specifier we can just store a from/to array. But that imply to be different JSSG step in the same codemod
Let's say this project is a very simple case: everything is CJS and the only CJS parts are top-level require()s and straightforward module.exportss.
No file extension updates are needed; the only "outside" update needed is setting pjson.type to "module", which doesn't depend on file extension updates.
Activity
require→ staticimports #345require→createRequire,import(), orimport.sync()#346module.exports→export#347import.meta.*#348AugustinMauroy commentedon Jan 22, 2026
IMO we shouldn't touch to typescript file for the first iteration.
FYI: i have opened a pr as draft to make some research about the good way to handle that #340
Also If we change the extension we will need to update some other part of the codebase which mean we need a way to track/store that.
In term of technical part we:
🚨IMPORTANT 🚨
I'm going to have a call today with codemod.com team to discuss about technical part. And with theses information I'm going to make an action plan.
JakobJingleheimer commentedon Jan 22, 2026
I accounted for that in the relevant sub-tickets 🙂
correct-ts-specifierscan handle that (just run it after the file extensions are changed—it should work for vanilla js extensions too; if it doesn't, it probably easily could).I just realised
correct-ts-specifiersneeds an update to also handlenode:test'smock.module.AugustinMauroy commentedon Jan 22, 2026
Okay what we will do :
Technical constraint, if we modify file ext we will need to store data (
from/to) somewhere. It's will be stored in state which is not available on steps that are Codemod Registry Step we will only use jssg step. So what it's implied for the user it's mean the user will just be able to run@nodejs/cjs-to-esmand not each step as independent thing.We can still block the user with manual step
JakobJingleheimer commentedon Jan 22, 2026
I think that's not necessarily true: they can run the individual steps, but they can't automatically update file extensions (which they may not even need to do). No?
AugustinMauroy commentedon Jan 23, 2026
Saddly if we want to harmonize everything on use codebase we need to update ext to
js+ update package.jsontypekey. To not have to do some intensive fs call to verify all import specifier we can just store afrom/toarray. But that imply to be different JSSG step in the same codemodJakobJingleheimer commentedon Jan 23, 2026
No, what I mean is something like this:
Let's say this project is a very simple case: everything is CJS and the only CJS parts are top-level
require()s and straightforwardmodule.exportss.No file extension updates are needed; the only "outside" update needed is setting pjson.type to
"module", which doesn't depend on file extension updates.