Uh oh!
There was an error while loading. Please reload this page.
Make TypeScript itself ESM-only, made possible by require(ESM) - #58419
Make TypeScript itself ESM-only, made possible by require(ESM)#58419Jake Bailey (jakebailey) wants to merge 6 commits into
Conversation
TypeScript Bot (typescript-bot)
commented
May 2, 2024
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping Sheetal Nandi (@sheetalkamat), Matt Bierner (@mjbvz), Kat Marchán (@zkat), and Joaquin Jares (@joj) for you. Feel free to loop in other consumers/maintainers if necessary. |
0290acc to
69aa00fCompare9a1860f to
42acb3bCompareJake Bailey (jakebailey)
commented
May 7, 2024
This has been rebased now that we're using extensions on main, condensing this down to a pretty small change (though there's still stuff not working). |
bed73cc to
739c9bfCompareTypeScript Bot (typescript-bot)
commented
May 7, 2024
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure Daniel Rosenwasser (@DanielRosenwasser) and Ryan Cavanaugh (@RyanCavanaugh) are aware of the changes, just as a heads up. |
Jake Bailey (jakebailey)
commented
May 7, 2024
There are still a bunch of TODOs, but this is actually green! Wow! |
18d1d83 to
423f584CompareJake Bailey (jakebailey)
commented
May 31, 2024
nodejs/node#52762 was merged a bit ago; I should be able to retarget this PR at nightly. |
423f584 to
84d3641Compare2b28c0b to
64ac0d2Compare7c70c64 to
208e064Compare212ec1a to
f3cb303Compare793228e to
4c232d5Compare4c232d5 to
520f2beComparee272d8f to
8a63274CompareJake Bailey (jakebailey)
commented
Oct 17, 2024
TypeScript Bot (@typescript-bot) perf test this faster hosts=node@23.0.0 |
TypeScript Bot (typescript-bot)
commented
Oct 17, 2024
Jake Bailey (@jakebailey) Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Jake Bailey (jakebailey)
commented
Oct 17, 2024
Huh, where is the perf hit coming from here...? |
8a63274 to
af313e5Compareaf313e5 to
c5a2ca4CompareJake Bailey (jakebailey)
commented
Sep 22, 2025
Given the Go port, I don't think it makes sense for me to attempt this anymore. I think it's only going to cause more churn in the meantime. |
nodejs/node#51977 (behind
--experimental-require-modulein Node 22) enables Node to require ESM so long as that ESM does not make use of top-level await. TypeScript would only need top-level await to constructts.sysat startup, which must be defined when the environment is detected to be Node. Via nodejs/node#52599 and nodejs/node#51977, we can synchronously access Node's built-ins, and therefore can offer up a TLA-free public API, enabling TypeScript to ship as ESM-only without breaking CJS users, oncerequire(ESM)is unflagged.TODO:
__esModulerequire(ESM)having__esModule. But I suspect that exportingdefaultfixes this.requireifprocess.getBuiltinModuleis not foundMaybe still ship CJS behind a condition to get this out sooner?Dual package hazard is very scary here. Maybe acceptable withmodulecondition/top-level prop?Stop bundling? Share code between tsc.js/typescript.js?@types/diffis typed wrong