* Fix moduleAttributesVersion errors with stage-0 preset in babel standalone * Add regression test for stage-0 not erroring on missing moduleattributes version * Remove moduleAttributesVersion from preset config
22 lines
581 B
JavaScript
22 lines
581 B
JavaScript
import { declare } from "@babel/helper-plugin-utils";
|
|
|
|
export default declare((api, { version }) => {
|
|
api.assertVersion(7);
|
|
|
|
if (typeof version !== "string" || version !== "may-2020") {
|
|
throw new Error(
|
|
"The 'moduleAttributes' plugin requires a 'version' option," +
|
|
" representing the last proposal update. Currently, the" +
|
|
" only supported value is 'may-2020'.",
|
|
);
|
|
}
|
|
|
|
return {
|
|
name: "syntax-module-attributes",
|
|
|
|
manipulateOptions(opts, parserOpts) {
|
|
parserOpts.plugins.push(["moduleAttributes", { version }]);
|
|
},
|
|
};
|
|
});
|