@@ -8,6 +8,19 @@ const archivedSyntaxPkgs = importJSON(
88 new URL ( "./archived-syntax-pkgs.json" , import . meta. url )
99) ;
1010
11+ const thirdPartyBabelPlugins = [
12+ "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class" ,
13+ "@babel/preset-modules/lib/plugins/transform-edge-default-parameters" ,
14+ "@babel/preset-modules/lib/plugins/transform-edge-function-name" ,
15+ "@babel/preset-modules/lib/plugins/transform-tagged-template-caching" ,
16+ "@babel/preset-modules/lib/plugins/transform-safari-block-shadowing" ,
17+ "@babel/preset-modules/lib/plugins/transform-safari-for-shadowing" ,
18+ "babel-plugin-polyfill-corejs2" ,
19+ "babel-plugin-polyfill-corejs3" ,
20+ "babel-plugin-polyfill-regenerator" ,
21+ "regenerator-transform" ,
22+ ] ;
23+
1124const root = new URL ( "../../" , import . meta. url ) ;
1225
1326function getTsPkgs ( subRoot ) {
@@ -28,6 +41,14 @@ function getTsPkgs(subRoot) {
2841 if ( name === "babel-standalone" ) {
2942 return [ [ "" , "/src" ] ] ;
3043 }
44+ if ( name === "babel-compat-data" ) {
45+ // map ./plugins to ./data/plugins.json
46+ const subExport = _export . slice ( 1 ) ;
47+ const subExportPath = exportPath
48+ . replace ( "./" , "/data/" )
49+ . replace ( / \. j s $ / , ".json" ) ;
50+ return [ [ subExport , subExportPath ] ] ;
51+ }
3152 // [{esm, default}, "./lib/index.js"]
3253 if ( Array . isArray ( exportPath ) ) {
3354 exportPath = exportPath [ 1 ] ;
@@ -55,8 +76,10 @@ function getTsPkgs(subRoot) {
5576 } )
5677 . filter (
5778 ( { name, relative } ) =>
58- // babel- register is special-cased because its entry point is a js file
79+ // @ babel/ register is special-cased because its entry point is a js file
5980 name === "@babel/register" ||
81+ // @babel /compat-data is used by preset-env
82+ name === "@babel/compat-data" ||
6083 fs . existsSync ( new URL ( relative + "/src/index.ts" , root ) )
6184 ) ;
6285}
@@ -85,6 +108,14 @@ fs.writeFileSync(
85108 name ,
86109 [ "./lib/archived-libs.d.ts" ] ,
87110 ] ) ,
111+ ...thirdPartyBabelPlugins . map ( name => [
112+ name ,
113+ [ "./lib/third-party-libs.d.ts" ] ,
114+ ] ) ,
115+ [
116+ "babel-plugin-dynamic-import-node/utils" ,
117+ [ "./lib/babel-plugin-dynamic-import-node.d.ts" ] ,
118+ ] ,
88119 ] ) ,
89120 } ,
90121 } ,
0 commit comments