diff --git a/packages/babel-parser/src/parser/statement.ts b/packages/babel-parser/src/parser/statement.ts index 5d760bde35a3..4554519b2cec 100644 --- a/packages/babel-parser/src/parser/statement.ts +++ b/packages/babel-parser/src/parser/statement.ts @@ -3272,6 +3272,7 @@ export default abstract class StatementParser extends ExpressionParser { at: this.state.startLoc, }); } + this.addExtra(node, "deprecatedAssertSyntax", true); } else { this.expectOnePlugin(["importAttributes", "importAssertions"]); } diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/_deprecated-syntax-not-enabled/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/_deprecated-syntax-not-enabled/output.json index 53f58525cedd..8853bf96e9cf 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/_deprecated-syntax-not-enabled/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/_deprecated-syntax-not-enabled/output.json @@ -23,6 +23,9 @@ }, "value": "foo" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-export-with-repeated-type/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-export-with-repeated-type/output.json index d4a0809e4fba..0ca2d0dfa459 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-export-with-repeated-type/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-export-with-repeated-type/output.json @@ -39,6 +39,9 @@ "value": "foo.json" }, "declaration": null, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-with-repeated-type-string/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-with-repeated-type-string/output.json index 9f831461ecb7..a38e8ca773ad 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-with-repeated-type-string/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-with-repeated-type-string/output.json @@ -34,6 +34,9 @@ }, "value": "foo.json" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-with-repeated-type/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-with-repeated-type/output.json index 7f92471bde26..5dda866489bb 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-with-repeated-type/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/invalid-syntax-with-repeated-type/output.json @@ -33,6 +33,9 @@ }, "value": "foo.json" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/string-literal/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/string-literal/output.json index 028758eb28c2..12de4ce318e9 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/string-literal/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/string-literal/output.json @@ -30,6 +30,9 @@ }, "value": "foo.json" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", @@ -80,6 +83,9 @@ "value": "foo.json" }, "declaration": null, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/trailing-comma/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/trailing-comma/output.json index 2870e142e9fe..4f7a07fb7d12 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/trailing-comma/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/trailing-comma/output.json @@ -30,6 +30,9 @@ }, "value": "foo" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", @@ -80,6 +83,9 @@ "value": "foo" }, "declaration": null, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-empty-attribute/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-empty-attribute/output.json index f444dd79bfa0..9e0e7456683b 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-empty-attribute/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-empty-attribute/output.json @@ -44,6 +44,9 @@ }, "value": "foo" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [] }, { @@ -69,6 +72,9 @@ }, "value": "foo" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [] }, { @@ -100,6 +106,9 @@ "value": "foo" }, "declaration": null, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [] }, { @@ -125,6 +134,9 @@ }, "value": "foo" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [] } ], diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-string-attribute-key/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-string-attribute-key/output.json index b7aab7f55f63..0074b0321a3b 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-string-attribute-key/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-string-attribute-key/output.json @@ -20,6 +20,9 @@ }, "value": "foo" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-star-as-with-attributes/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-star-as-with-attributes/output.json index a24aa286da44..6d7f109c6407 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-star-as-with-attributes/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-star-as-with-attributes/output.json @@ -30,6 +30,9 @@ }, "value": "foo.json" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-star-with-attributes/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-star-with-attributes/output.json index 0ea124ba9489..f42382b6464a 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-star-with-attributes/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-star-with-attributes/output.json @@ -19,6 +19,9 @@ }, "value": "foo.json" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-and-attributes-multiple-lines/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-and-attributes-multiple-lines/output.json index 11fe42fa9342..25eb9798644e 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-and-attributes-multiple-lines/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-and-attributes-multiple-lines/output.json @@ -36,6 +36,9 @@ "value": "foo" }, "declaration": null, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-attributes-and-value/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-attributes-and-value/output.json index e093fe987625..f54b23ef648a 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-attributes-and-value/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-attributes-and-value/output.json @@ -40,6 +40,9 @@ "value": "foo" }, "declaration": null, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-attributes/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-attributes/output.json index cee3cd708a4a..e9aac7844abf 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-attributes/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-attributes/output.json @@ -36,6 +36,9 @@ "value": "foo.json" }, "declaration": null, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-no-type-attribute/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-no-type-attribute/output.json index eb72dd1490b1..fec5d1d74d05 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-no-type-attribute/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-no-type-attribute/output.json @@ -36,6 +36,9 @@ "value": "foo.json" }, "declaration": null, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-object-method-attribute/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-object-method-attribute/output.json index 3674100b543a..9d93fb9e8c5d 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-object-method-attribute/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-export-with-object-method-attribute/output.json @@ -36,6 +36,9 @@ "value": "foo.json" }, "declaration": null, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes-and-value/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes-and-value/output.json index 1418fc8d377b..1d69cd33002e 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes-and-value/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes-and-value/output.json @@ -20,6 +20,9 @@ }, "value": "x" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes-multiple-lines/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes-multiple-lines/output.json index 7c1059614604..29f54e0c1f5c 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes-multiple-lines/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes-multiple-lines/output.json @@ -20,6 +20,9 @@ }, "value": "x" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes/output.json index 80699a71c747..b244dc504ac8 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-attributes/output.json @@ -30,6 +30,9 @@ }, "value": "foo.json" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-no-type-attribute/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-no-type-attribute/output.json index 90f26790666b..2c33092237e9 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-no-type-attribute/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-no-type-attribute/output.json @@ -30,6 +30,9 @@ }, "value": "foo.json" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute", diff --git a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-object-method-attribute/output.json b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-object-method-attribute/output.json index aa3b7292dfb3..56706a39c7b7 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-object-method-attribute/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-attributes-deprecatedAssertKeyword/valid-syntax-with-object-method-attribute/output.json @@ -30,6 +30,9 @@ }, "value": "foo.json" }, + "extra": { + "deprecatedAssertSyntax": true + }, "attributes": [ { "type": "ImportAttribute",