-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename module-attributes to import-assertions
- Loading branch information
Showing
17 changed files
with
271 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/experimental/_no-plugin/import-assertions/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import foo from "foo.json" assert { type: "json" }; |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/experimental/import-assertions/string-literal/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import foo from "foo.json" assert { for: "for" } |
11 changes: 11 additions & 0 deletions
11
...ges/babel-parser/test/fixtures/experimental/import-assertions/string-literal/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"importAssertions", | ||
{ | ||
"version": "september-2020" | ||
} | ||
] | ||
], | ||
"sourceType": "module" | ||
} |
60 changes: 60 additions & 0 deletions
60
...ages/babel-parser/test/fixtures/experimental/import-assertions/string-literal/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, | ||
"errors": [ | ||
"SyntaxError: The only accepted module attribute is `type` (1:36)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ImportDeclaration", | ||
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, | ||
"specifiers": [ | ||
{ | ||
"type": "ImportDefaultSpecifier", | ||
"start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, | ||
"local": { | ||
"type": "Identifier", | ||
"start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"}, | ||
"name": "foo" | ||
} | ||
} | ||
], | ||
"source": { | ||
"type": "StringLiteral", | ||
"start":16,"end":26,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":26}}, | ||
"extra": { | ||
"rawValue": "foo.json", | ||
"raw": "\"foo.json\"" | ||
}, | ||
"value": "foo.json" | ||
}, | ||
"assertions": [ | ||
{ | ||
"type": "ImportAttribute", | ||
"start":36,"end":46,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":46}}, | ||
"key": { | ||
"type": "Identifier", | ||
"start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39},"identifierName":"for"}, | ||
"name": "for" | ||
}, | ||
"value": { | ||
"type": "StringLiteral", | ||
"start":41,"end":46,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":46}}, | ||
"extra": { | ||
"rawValue": "for", | ||
"raw": "\"for\"" | ||
}, | ||
"value": "for" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...babel-parser/test/fixtures/experimental/import-assertions/trailing-comma-dynamic/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import("foo.js",); | ||
import("foo.json", { assert: { type: "json" } },); |
11 changes: 11 additions & 0 deletions
11
...l-parser/test/fixtures/experimental/import-assertions/trailing-comma-dynamic/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"importAssertions", | ||
{ | ||
"version": "september-2020" | ||
} | ||
] | ||
], | ||
"sourceType": "module" | ||
} |
110 changes: 110 additions & 0 deletions
110
...el-parser/test/fixtures/experimental/import-assertions/trailing-comma-dynamic/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":50}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":50}}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, | ||
"callee": { | ||
"type": "Import", | ||
"start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}} | ||
}, | ||
"extra": { | ||
"trailingComma": 15 | ||
}, | ||
"arguments": [ | ||
{ | ||
"type": "StringLiteral", | ||
"start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, | ||
"extra": { | ||
"rawValue": "foo.js", | ||
"raw": "\"foo.js\"" | ||
}, | ||
"value": "foo.js" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":19,"end":69,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":50}}, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start":19,"end":68,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":49}}, | ||
"callee": { | ||
"type": "Import", | ||
"start":19,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}} | ||
}, | ||
"extra": { | ||
"trailingComma": 66 | ||
}, | ||
"arguments": [ | ||
{ | ||
"type": "StringLiteral", | ||
"start":26,"end":36,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":17}}, | ||
"extra": { | ||
"rawValue": "foo.json", | ||
"raw": "\"foo.json\"" | ||
}, | ||
"value": "foo.json" | ||
}, | ||
{ | ||
"type": "ObjectExpression", | ||
"start":38,"end":66,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":47}}, | ||
"properties": [ | ||
{ | ||
"type": "ObjectProperty", | ||
"start":40,"end":64,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":45}}, | ||
"method": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":40,"end":46,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":27},"identifierName":"assert"}, | ||
"name": "assert" | ||
}, | ||
"computed": false, | ||
"shorthand": false, | ||
"value": { | ||
"type": "ObjectExpression", | ||
"start":48,"end":64,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":45}}, | ||
"properties": [ | ||
{ | ||
"type": "ObjectProperty", | ||
"start":50,"end":62,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":43}}, | ||
"method": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":50,"end":54,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":35},"identifierName":"type"}, | ||
"name": "type" | ||
}, | ||
"computed": false, | ||
"shorthand": false, | ||
"value": { | ||
"type": "StringLiteral", | ||
"start":56,"end":62,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":43}}, | ||
"extra": { | ||
"rawValue": "json", | ||
"raw": "\"json\"" | ||
}, | ||
"value": "json" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
packages/babel-parser/test/fixtures/experimental/import-assertions/trailing-comma/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
import("foo.js",); | ||
import("foo.json", { assert: { type: "json" } },); | ||
import foo from "foo" assert { foo: "foo", } |
130 changes: 40 additions & 90 deletions
130
...ages/babel-parser/test/fixtures/experimental/import-assertions/trailing-comma/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.