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 Jun 11, 2022
1 parent 5dc9f43 commit ee6dca5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
16 changes: 6 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,11 @@ 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"],
sourceType: "module",
});

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.17.12",
"@babel/plugin-proposal-object-rest-spread": "^7.18.0",
Expand Down
3 changes: 2 additions & 1 deletion yarn.lock
Expand Up @@ -1067,7 +1067,7 @@ __metadata:
languageName: unknown
linkType: soft

"@babel/parser@npm:^7.0.0, @babel/parser@npm:^7.12.7, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.15.4, @babel/parser@npm:^7.15.8, @babel/parser@npm:^7.16.7, @babel/parser@npm:^7.18.0":
"@babel/parser@npm:^7.0.0, @babel/parser@npm:^7.12.7, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.15.4, @babel/parser@npm:^7.15.8, @babel/parser@npm:^7.16.7, @babel/parser@npm:^7.17.8, @babel/parser@npm:^7.18.0":
version: 7.18.0
resolution: "@babel/parser@npm:7.18.0"
bin:
Expand Down Expand Up @@ -5911,6 +5911,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.17.12
"@babel/plugin-proposal-object-rest-spread": ^7.18.0
Expand Down

0 comments on commit ee6dca5

Please sign in to comment.