Skip to content

Commit 73cfaba

Browse files
deps: update acorn to 8.14.0
PR-URL: #55699 Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 0b58160 commit 73cfaba

File tree

7 files changed

+280
-30
lines changed

7 files changed

+280
-30
lines changed

deps/acorn/acorn/CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 8.14.0 (2024-10-27)
2+
3+
### New features
4+
5+
Support ES2025 import attributes.
6+
7+
Support ES2025 RegExp modifiers.
8+
9+
### Bug fixes
10+
11+
Support some missing Unicode properties.
12+
113
## 8.13.0 (2024-10-16)
214

315
### New features

deps/acorn/acorn/dist/acorn.d.mts

+11-1
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ export interface ImportDeclaration extends Node {
403403
type: "ImportDeclaration"
404404
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>
405405
source: Literal
406+
attributes: Array<ImportAttribute>
406407
}
407408

408409
export interface ImportSpecifier extends Node {
@@ -421,11 +422,18 @@ export interface ImportNamespaceSpecifier extends Node {
421422
local: Identifier
422423
}
423424

425+
export interface ImportAttribute extends Node {
426+
type: "ImportAttribute"
427+
key: Identifier | Literal
428+
value: Literal
429+
}
430+
424431
export interface ExportNamedDeclaration extends Node {
425432
type: "ExportNamedDeclaration"
426433
declaration?: Declaration | null
427434
specifiers: Array<ExportSpecifier>
428435
source?: Literal | null
436+
attributes: Array<ImportAttribute>
429437
}
430438

431439
export interface ExportSpecifier extends Node {
@@ -454,6 +462,7 @@ export interface ExportAllDeclaration extends Node {
454462
type: "ExportAllDeclaration"
455463
source: Literal
456464
exported?: Identifier | Literal | null
465+
attributes: Array<ImportAttribute>
457466
}
458467

459468
export interface AwaitExpression extends Node {
@@ -469,6 +478,7 @@ export interface ChainExpression extends Node {
469478
export interface ImportExpression extends Node {
470479
type: "ImportExpression"
471480
source: Expression
481+
options: Expression | null
472482
}
473483

474484
export interface ParenthesizedExpression extends Node {
@@ -562,7 +572,7 @@ export type ModuleDeclaration =
562572
| ExportDefaultDeclaration
563573
| ExportAllDeclaration
564574

565-
export type AnyNode = Statement | Expression | Declaration | ModuleDeclaration | Literal | Program | SwitchCase | CatchClause | Property | Super | SpreadElement | TemplateElement | AssignmentProperty | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | ClassBody | MethodDefinition | MetaProperty | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | AnonymousFunctionDeclaration | AnonymousClassDeclaration | PropertyDefinition | PrivateIdentifier | StaticBlock | VariableDeclarator
575+
export type AnyNode = Statement | Expression | Declaration | ModuleDeclaration | Literal | Program | SwitchCase | CatchClause | Property | Super | SpreadElement | TemplateElement | AssignmentProperty | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | ClassBody | MethodDefinition | MetaProperty | ImportAttribute | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | AnonymousFunctionDeclaration | AnonymousClassDeclaration | PropertyDefinition | PrivateIdentifier | StaticBlock | VariableDeclarator
566576

567577
export function parse(input: string, options: Options): Program
568578

deps/acorn/acorn/dist/acorn.d.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ export interface ImportDeclaration extends Node {
403403
type: "ImportDeclaration"
404404
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>
405405
source: Literal
406+
attributes: Array<ImportAttribute>
406407
}
407408

408409
export interface ImportSpecifier extends Node {
@@ -421,11 +422,18 @@ export interface ImportNamespaceSpecifier extends Node {
421422
local: Identifier
422423
}
423424

425+
export interface ImportAttribute extends Node {
426+
type: "ImportAttribute"
427+
key: Identifier | Literal
428+
value: Literal
429+
}
430+
424431
export interface ExportNamedDeclaration extends Node {
425432
type: "ExportNamedDeclaration"
426433
declaration?: Declaration | null
427434
specifiers: Array<ExportSpecifier>
428435
source?: Literal | null
436+
attributes: Array<ImportAttribute>
429437
}
430438

431439
export interface ExportSpecifier extends Node {
@@ -454,6 +462,7 @@ export interface ExportAllDeclaration extends Node {
454462
type: "ExportAllDeclaration"
455463
source: Literal
456464
exported?: Identifier | Literal | null
465+
attributes: Array<ImportAttribute>
457466
}
458467

459468
export interface AwaitExpression extends Node {
@@ -469,6 +478,7 @@ export interface ChainExpression extends Node {
469478
export interface ImportExpression extends Node {
470479
type: "ImportExpression"
471480
source: Expression
481+
options: Expression | null
472482
}
473483

474484
export interface ParenthesizedExpression extends Node {
@@ -562,7 +572,7 @@ export type ModuleDeclaration =
562572
| ExportDefaultDeclaration
563573
| ExportAllDeclaration
564574

565-
export type AnyNode = Statement | Expression | Declaration | ModuleDeclaration | Literal | Program | SwitchCase | CatchClause | Property | Super | SpreadElement | TemplateElement | AssignmentProperty | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | ClassBody | MethodDefinition | MetaProperty | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | AnonymousFunctionDeclaration | AnonymousClassDeclaration | PropertyDefinition | PrivateIdentifier | StaticBlock | VariableDeclarator
575+
export type AnyNode = Statement | Expression | Declaration | ModuleDeclaration | Literal | Program | SwitchCase | CatchClause | Property | Super | SpreadElement | TemplateElement | AssignmentProperty | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | ClassBody | MethodDefinition | MetaProperty | ImportAttribute | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | AnonymousFunctionDeclaration | AnonymousClassDeclaration | PropertyDefinition | PrivateIdentifier | StaticBlock | VariableDeclarator
566576

567577
export function parse(input: string, options: Options): Program
568578

deps/acorn/acorn/dist/acorn.js

+122-13
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@
16781678
this.expectContextual("from");
16791679
if (this.type !== types$1.string) { this.unexpected(); }
16801680
node.source = this.parseExprAtom();
1681+
if (this.options.ecmaVersion >= 16)
1682+
{ node.attributes = this.parseWithClause(); }
16811683
this.semicolon();
16821684
return this.finishNode(node, "ExportAllDeclaration")
16831685
};
@@ -1708,6 +1710,8 @@
17081710
if (this.eatContextual("from")) {
17091711
if (this.type !== types$1.string) { this.unexpected(); }
17101712
node.source = this.parseExprAtom();
1713+
if (this.options.ecmaVersion >= 16)
1714+
{ node.attributes = this.parseWithClause(); }
17111715
} else {
17121716
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
17131717
// check for keywords used as local names
@@ -1848,6 +1852,8 @@
18481852
this.expectContextual("from");
18491853
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
18501854
}
1855+
if (this.options.ecmaVersion >= 16)
1856+
{ node.attributes = this.parseWithClause(); }
18511857
this.semicolon();
18521858
return this.finishNode(node, "ImportDeclaration")
18531859
};
@@ -1908,6 +1914,41 @@
19081914
return nodes
19091915
};
19101916

1917+
pp$8.parseWithClause = function() {
1918+
var nodes = [];
1919+
if (!this.eat(types$1._with)) {
1920+
return nodes
1921+
}
1922+
this.expect(types$1.braceL);
1923+
var attributeKeys = {};
1924+
var first = true;
1925+
while (!this.eat(types$1.braceR)) {
1926+
if (!first) {
1927+
this.expect(types$1.comma);
1928+
if (this.afterTrailingComma(types$1.braceR)) { break }
1929+
} else { first = false; }
1930+
1931+
var attr = this.parseImportAttribute();
1932+
var keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value;
1933+
if (hasOwn(attributeKeys, keyName))
1934+
{ this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName + "'"); }
1935+
attributeKeys[keyName] = true;
1936+
nodes.push(attr);
1937+
}
1938+
return nodes
1939+
};
1940+
1941+
pp$8.parseImportAttribute = function() {
1942+
var node = this.startNode();
1943+
node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
1944+
this.expect(types$1.colon);
1945+
if (this.type !== types$1.string) {
1946+
this.unexpected();
1947+
}
1948+
node.value = this.parseExprAtom();
1949+
return this.finishNode(node, "ImportAttribute")
1950+
};
1951+
19111952
pp$8.parseModuleExportName = function() {
19121953
if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
19131954
var stringLiteral = this.parseLiteral(this.value);
@@ -2975,13 +3016,32 @@
29753016
// Parse node.source.
29763017
node.source = this.parseMaybeAssign();
29773018

2978-
// Verify ending.
2979-
if (!this.eat(types$1.parenR)) {
2980-
var errorPos = this.start;
2981-
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
2982-
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
3019+
if (this.options.ecmaVersion >= 16) {
3020+
if (!this.eat(types$1.parenR)) {
3021+
this.expect(types$1.comma);
3022+
if (!this.afterTrailingComma(types$1.parenR)) {
3023+
node.options = this.parseMaybeAssign();
3024+
if (!this.eat(types$1.parenR)) {
3025+
this.expect(types$1.comma);
3026+
if (!this.afterTrailingComma(types$1.parenR)) {
3027+
this.unexpected();
3028+
}
3029+
}
3030+
} else {
3031+
node.options = null;
3032+
}
29833033
} else {
2984-
this.unexpected(errorPos);
3034+
node.options = null;
3035+
}
3036+
} else {
3037+
// Verify ending.
3038+
if (!this.eat(types$1.parenR)) {
3039+
var errorPos = this.start;
3040+
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
3041+
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
3042+
} else {
3043+
this.unexpected(errorPos);
3044+
}
29853045
}
29863046
}
29873047

@@ -3741,6 +3801,9 @@
37413801
return newNode
37423802
};
37433803

3804+
// This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually!
3805+
var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz";
3806+
37443807
// This file contains Unicode properties extracted from the ECMAScript specification.
37453808
// The lists are extracted like so:
37463809
// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)
@@ -3783,7 +3846,7 @@
37833846
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
37843847
var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
37853848
var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
3786-
var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
3849+
var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode;
37873850

37883851
var unicodeScriptValues = {
37893852
9: ecma9ScriptValues,
@@ -4208,12 +4271,41 @@
42084271
pp$1.regexp_eatUncapturingGroup = function(state) {
42094272
var start = state.pos;
42104273
if (state.eat(0x28 /* ( */)) {
4211-
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
4212-
this.regexp_disjunction(state);
4213-
if (state.eat(0x29 /* ) */)) {
4214-
return true
4274+
if (state.eat(0x3F /* ? */)) {
4275+
if (this.options.ecmaVersion >= 16) {
4276+
var addModifiers = this.regexp_eatModifiers(state);
4277+
var hasHyphen = state.eat(0x2D /* - */);
4278+
if (addModifiers || hasHyphen) {
4279+
for (var i = 0; i < addModifiers.length; i++) {
4280+
var modifier = addModifiers.charAt(i);
4281+
if (addModifiers.indexOf(modifier, i + 1) > -1) {
4282+
state.raise("Duplicate regular expression modifiers");
4283+
}
4284+
}
4285+
if (hasHyphen) {
4286+
var removeModifiers = this.regexp_eatModifiers(state);
4287+
if (!addModifiers && !removeModifiers && state.current() === 0x3A /* : */) {
4288+
state.raise("Invalid regular expression modifiers");
4289+
}
4290+
for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {
4291+
var modifier$1 = removeModifiers.charAt(i$1);
4292+
if (
4293+
removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 ||
4294+
addModifiers.indexOf(modifier$1) > -1
4295+
) {
4296+
state.raise("Duplicate regular expression modifiers");
4297+
}
4298+
}
4299+
}
4300+
}
4301+
}
4302+
if (state.eat(0x3A /* : */)) {
4303+
this.regexp_disjunction(state);
4304+
if (state.eat(0x29 /* ) */)) {
4305+
return true
4306+
}
4307+
state.raise("Unterminated group");
42154308
}
4216-
state.raise("Unterminated group");
42174309
}
42184310
state.pos = start;
42194311
}
@@ -4235,6 +4327,23 @@
42354327
}
42364328
return false
42374329
};
4330+
// RegularExpressionModifiers ::
4331+
// [empty]
4332+
// RegularExpressionModifiers RegularExpressionModifier
4333+
pp$1.regexp_eatModifiers = function(state) {
4334+
var modifiers = "";
4335+
var ch = 0;
4336+
while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) {
4337+
modifiers += codePointToString(ch);
4338+
state.advance();
4339+
}
4340+
return modifiers
4341+
};
4342+
// RegularExpressionModifier :: one of
4343+
// `i` `m` `s`
4344+
function isRegularExpressionModifier(ch) {
4345+
return ch === 0x69 /* i */ || ch === 0x6d /* m */ || ch === 0x73 /* s */
4346+
}
42384347

42394348
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
42404349
pp$1.regexp_eatExtendedAtom = function(state) {
@@ -5990,7 +6099,7 @@
59906099
// [walk]: util/walk.js
59916100

59926101

5993-
var version = "8.13.0";
6102+
var version = "8.14.0";
59946103

59956104
Parser.acorn = {
59966105
Parser: Parser,

0 commit comments

Comments
 (0)