Archive syntax plugins enabled by default (#10820)
* Remove syntax plugins enabled by default Moved to babel-archive: babel/babel-archive@8f23ddce03 - `@babel/plugin-syntax-async-generators` - `@babel/plugin-syntax-bigint` - `@babel/plugin-syntax-dynamic-import` - `@babel/plugin-syntax-json-strings` - `@babel/plugin-syntax-nullish-coalescing-operator` - `@babel/plugin-syntax-object-rest-spread` - `@babel/plugin-syntax-optional-catch-binding` - `@babel/plugin-syntax-optional-chaining` * Fix build script * Fix jest config * Remove archived plugins from tests
This commit is contained in:
@@ -48,26 +48,37 @@ module.exports = function() {
|
||||
}
|
||||
|
||||
const matches = importee.match(/^@babel\/([^/]+)$/);
|
||||
if (matches) {
|
||||
const packageFolderName = `babel-${matches[1]}`;
|
||||
if (!matches) return null;
|
||||
|
||||
// resolve babel package names to their src index file
|
||||
const packageFolder = path.join(dirname, "packages", packageFolderName);
|
||||
const packageJson = require(path.join(packageFolder, "package.json"));
|
||||
// resolve babel package names to their src index file
|
||||
const packageFolder = path.join(
|
||||
dirname,
|
||||
"packages",
|
||||
`babel-${matches[1]}`
|
||||
);
|
||||
|
||||
const filename =
|
||||
typeof packageJson["browser"] === "string"
|
||||
? packageJson["browser"]
|
||||
: packageJson["main"];
|
||||
|
||||
return path.join(
|
||||
packageFolder,
|
||||
// replace lib with src in the pkg.json entry
|
||||
filename.replace(/^(\.\/)?lib\//, "src/")
|
||||
let packageJsonSource;
|
||||
try {
|
||||
packageJsonSource = fs.readFileSync(
|
||||
path.join(packageFolder, "package.json")
|
||||
);
|
||||
} catch (e) {
|
||||
// Some Babel packahes aren't in this repository, but in
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
const packageJson = JSON.parse(packageJsonSource);
|
||||
|
||||
const filename =
|
||||
typeof packageJson["browser"] === "string"
|
||||
? packageJson["browser"]
|
||||
: packageJson["main"];
|
||||
|
||||
return path.join(
|
||||
packageFolder,
|
||||
// replace lib with src in the pkg.json entry
|
||||
filename.replace(/^(\.\/)?lib\//, "src/")
|
||||
);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user