Skip to content

Commit

Permalink
Fix building Babel with itself
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Mar 20, 2022
1 parent feef338 commit 952a629
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
15 changes: 5 additions & 10 deletions babel.config.js
Expand Up @@ -2,7 +2,7 @@

const pathUtils = require("path");
const fs = require("fs");
const { parseSync } = require("@babel/core");
const { parse } = require("@babel/parser");

function normalize(src) {
return src.replace(/\//, pathUtils.sep);
Expand Down Expand Up @@ -763,15 +763,10 @@ function pluginBabelParserTokenType({
}

(function generateTokenTypesMapping() {
const tokenTypesAst = parseSync(
fs.readFileSync(tokenTypeSourcePath, {
encoding: "utf-8",
}),
{
configFile: false,
parserOpts: { attachComments: false, plugins: ["flow"] },
}
);
const tokenTypesAst = parse(fs.readFileSync(tokenTypeSourcePath, "utf-8"), {
attachComments: false,
plugins: ["flow"],
});

let typesDeclaration;
for (const n of tokenTypesAst.program.body) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -25,6 +25,7 @@
"@babel/eslint-parser": "workspace:^",
"@babel/eslint-plugin-development": "workspace:^",
"@babel/eslint-plugin-development-internal": "workspace:^",
"@babel/parser": "^7.17.8",
"@babel/plugin-proposal-dynamic-import": "^7.16.7",
"@babel/plugin-proposal-export-namespace-from": "^7.16.7",
"@babel/plugin-proposal-object-rest-spread": "^7.16.7",
Expand Down
9 changes: 5 additions & 4 deletions yarn.lock
Expand Up @@ -1090,12 +1090,12 @@ __metadata:
languageName: unknown
linkType: soft

"@babel/parser@npm:^7.0.0, @babel/parser@npm:^7.12.7, @babel/parser@npm:^7.15.4, @babel/parser@npm:^7.15.8, @babel/parser@npm:^7.16.7, @babel/parser@npm:^7.17.0, @babel/parser@npm:^7.7.2":
version: 7.17.0
resolution: "@babel/parser@npm:7.17.0"
"@babel/parser@npm:^7.0.0, @babel/parser@npm:^7.12.7, @babel/parser@npm:^7.15.4, @babel/parser@npm:^7.15.8, @babel/parser@npm:^7.16.7, @babel/parser@npm:^7.17.0, @babel/parser@npm:^7.17.8, @babel/parser@npm:^7.7.2":
version: 7.17.8
resolution: "@babel/parser@npm:7.17.8"
bin:
parser: ./bin/babel-parser.js
checksum: d0ac5ffba0b234dde516f867edf5da5d92d6f841592b370ae3244cd7c8f27a7f5e3e3d4e90ca9c15ea58bc46823f1643f3f75b6eb9a9f676ae16e8b2365e922a
checksum: 1771808491982cc47baa888a997aef6b58308e3844c8c00f730f8fd97defe57d32cdbf46075cd49aaee310fa31f3d2c80a0d41b41a4ee0ff336ee09e2ff6c222
languageName: node
linkType: hard

Expand Down Expand Up @@ -5921,6 +5921,7 @@ __metadata:
"@babel/eslint-parser": "workspace:^"
"@babel/eslint-plugin-development": "workspace:^"
"@babel/eslint-plugin-development-internal": "workspace:^"
"@babel/parser": ^7.17.8
"@babel/plugin-proposal-dynamic-import": ^7.16.7
"@babel/plugin-proposal-export-namespace-from": ^7.16.7
"@babel/plugin-proposal-object-rest-spread": ^7.16.7
Expand Down

0 comments on commit 952a629

Please sign in to comment.