added basic support for module attributes and tests updated (#10962)

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
Vivek Nayyar
2020-05-25 01:26:28 +02:00
committed by GitHub
parent c5ba345ac2
commit 66b86e088c
66 changed files with 1231 additions and 184 deletions

View File

@@ -0,0 +1,21 @@
import { declare } from "@babel/helper-plugin-utils";
export default declare((api, { version }) => {
api.assertVersion(7);
if (typeof version !== "string" || version !== "apr-2020") {
throw new Error(
"The 'moduleAttributes' plugin requires a 'version' option," +
" representing the last proposal update. Currently, the" +
" only supported value is 'apr-2020'.",
);
}
return {
name: "syntax-module-attributes",
manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push(["moduleAttributes", { version }]);
},
};
});