Parse import-assertions (#12139)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com> Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
19
packages/babel-plugin-syntax-import-assertions/README.md
Normal file
19
packages/babel-plugin-syntax-import-assertions/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/plugin-syntax-import-assertions
|
||||
|
||||
> Allow parsing of the module assertion attributes in the import statements
|
||||
|
||||
See our website [@babel/plugin-syntax-import-assertions](https://babeljs.io/docs/en/next/babel-plugin-syntax-import-assertions.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-syntax-import-assertions
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/plugin-syntax-import-assertions --dev
|
||||
```
|
||||
27
packages/babel-plugin-syntax-import-assertions/package.json
Normal file
27
packages/babel-plugin-syntax-import-assertions/package.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@babel/plugin-syntax-import-assertions",
|
||||
"version": "7.10.4",
|
||||
"description": "Allow parsing of the module assertion attributes in the import statement",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-plugin-syntax-import-assertions"
|
||||
},
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "workspace:^7.10.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "workspace:^7.10.4"
|
||||
}
|
||||
}
|
||||
13
packages/babel-plugin-syntax-import-assertions/src/index.js
Normal file
13
packages/babel-plugin-syntax-import-assertions/src/index.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { declare } from "@babel/helper-plugin-utils";
|
||||
|
||||
export default declare(api => {
|
||||
api.assertVersion(7);
|
||||
|
||||
return {
|
||||
name: "syntax-import-assertions",
|
||||
|
||||
manipulateOptions(opts, parserOpts) {
|
||||
parserOpts.plugins.push(["importAssertions"]);
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user