Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update acorn to 8.14.0 #55699

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions deps/acorn/acorn/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 8.14.0 (2024-10-27)

### New features

Support ES2025 import attributes.

Support ES2025 RegExp modifiers.

### Bug fixes

Support some missing Unicode properties.

## 8.13.0 (2024-10-16)

### New features
Expand Down
12 changes: 11 additions & 1 deletion deps/acorn/acorn/dist/acorn.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ export interface ImportDeclaration extends Node {
type: "ImportDeclaration"
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>
source: Literal
attributes: Array<ImportAttribute>
}

export interface ImportSpecifier extends Node {
Expand All @@ -421,11 +422,18 @@ export interface ImportNamespaceSpecifier extends Node {
local: Identifier
}

export interface ImportAttribute extends Node {
type: "ImportAttribute"
key: Identifier | Literal
value: Literal
}

export interface ExportNamedDeclaration extends Node {
type: "ExportNamedDeclaration"
declaration?: Declaration | null
specifiers: Array<ExportSpecifier>
source?: Literal | null
attributes: Array<ImportAttribute>
}

export interface ExportSpecifier extends Node {
Expand Down Expand Up @@ -454,6 +462,7 @@ export interface ExportAllDeclaration extends Node {
type: "ExportAllDeclaration"
source: Literal
exported?: Identifier | Literal | null
attributes: Array<ImportAttribute>
}

export interface AwaitExpression extends Node {
Expand All @@ -469,6 +478,7 @@ export interface ChainExpression extends Node {
export interface ImportExpression extends Node {
type: "ImportExpression"
source: Expression
options: Expression | null
}

export interface ParenthesizedExpression extends Node {
Expand Down Expand Up @@ -562,7 +572,7 @@ export type ModuleDeclaration =
| ExportDefaultDeclaration
| ExportAllDeclaration

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
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

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

Expand Down
12 changes: 11 additions & 1 deletion deps/acorn/acorn/dist/acorn.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ export interface ImportDeclaration extends Node {
type: "ImportDeclaration"
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>
source: Literal
attributes: Array<ImportAttribute>
}

export interface ImportSpecifier extends Node {
Expand All @@ -421,11 +422,18 @@ export interface ImportNamespaceSpecifier extends Node {
local: Identifier
}

export interface ImportAttribute extends Node {
type: "ImportAttribute"
key: Identifier | Literal
value: Literal
}

export interface ExportNamedDeclaration extends Node {
type: "ExportNamedDeclaration"
declaration?: Declaration | null
specifiers: Array<ExportSpecifier>
source?: Literal | null
attributes: Array<ImportAttribute>
}

export interface ExportSpecifier extends Node {
Expand Down Expand Up @@ -454,6 +462,7 @@ export interface ExportAllDeclaration extends Node {
type: "ExportAllDeclaration"
source: Literal
exported?: Identifier | Literal | null
attributes: Array<ImportAttribute>
}

export interface AwaitExpression extends Node {
Expand All @@ -469,6 +478,7 @@ export interface ChainExpression extends Node {
export interface ImportExpression extends Node {
type: "ImportExpression"
source: Expression
options: Expression | null
}

export interface ParenthesizedExpression extends Node {
Expand Down Expand Up @@ -562,7 +572,7 @@ export type ModuleDeclaration =
| ExportDefaultDeclaration
| ExportAllDeclaration

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
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

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

Expand Down
135 changes: 122 additions & 13 deletions deps/acorn/acorn/dist/acorn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,8 @@
this.expectContextual("from");
if (this.type !== types$1.string) { this.unexpected(); }
node.source = this.parseExprAtom();
if (this.options.ecmaVersion >= 16)
{ node.attributes = this.parseWithClause(); }
this.semicolon();
return this.finishNode(node, "ExportAllDeclaration")
};
Expand Down Expand Up @@ -1708,6 +1710,8 @@
if (this.eatContextual("from")) {
if (this.type !== types$1.string) { this.unexpected(); }
node.source = this.parseExprAtom();
if (this.options.ecmaVersion >= 16)
{ node.attributes = this.parseWithClause(); }
} else {
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
// check for keywords used as local names
Expand Down Expand Up @@ -1848,6 +1852,8 @@
this.expectContextual("from");
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
}
if (this.options.ecmaVersion >= 16)
{ node.attributes = this.parseWithClause(); }
this.semicolon();
return this.finishNode(node, "ImportDeclaration")
};
Expand Down Expand Up @@ -1908,6 +1914,41 @@
return nodes
};

pp$8.parseWithClause = function() {
var nodes = [];
if (!this.eat(types$1._with)) {
return nodes
}
this.expect(types$1.braceL);
var attributeKeys = {};
var first = true;
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.afterTrailingComma(types$1.braceR)) { break }
} else { first = false; }

var attr = this.parseImportAttribute();
var keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value;
if (hasOwn(attributeKeys, keyName))
{ this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName + "'"); }
attributeKeys[keyName] = true;
nodes.push(attr);
}
return nodes
};

pp$8.parseImportAttribute = function() {
var node = this.startNode();
node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
this.expect(types$1.colon);
if (this.type !== types$1.string) {
this.unexpected();
}
node.value = this.parseExprAtom();
return this.finishNode(node, "ImportAttribute")
};

pp$8.parseModuleExportName = function() {
if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
var stringLiteral = this.parseLiteral(this.value);
Expand Down Expand Up @@ -2975,13 +3016,32 @@
// Parse node.source.
node.source = this.parseMaybeAssign();

// Verify ending.
if (!this.eat(types$1.parenR)) {
var errorPos = this.start;
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
if (this.options.ecmaVersion >= 16) {
if (!this.eat(types$1.parenR)) {
this.expect(types$1.comma);
if (!this.afterTrailingComma(types$1.parenR)) {
node.options = this.parseMaybeAssign();
if (!this.eat(types$1.parenR)) {
this.expect(types$1.comma);
if (!this.afterTrailingComma(types$1.parenR)) {
this.unexpected();
}
}
} else {
node.options = null;
}
} else {
this.unexpected(errorPos);
node.options = null;
}
} else {
// Verify ending.
if (!this.eat(types$1.parenR)) {
var errorPos = this.start;
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
} else {
this.unexpected(errorPos);
}
}
}

Expand Down Expand Up @@ -3741,6 +3801,9 @@
return newNode
};

// This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually!
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";

// This file contains Unicode properties extracted from the ECMAScript specification.
// The lists are extracted like so:
// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)
Expand Down Expand Up @@ -3783,7 +3846,7 @@
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode;

var unicodeScriptValues = {
9: ecma9ScriptValues,
Expand Down Expand Up @@ -4208,12 +4271,41 @@
pp$1.regexp_eatUncapturingGroup = function(state) {
var start = state.pos;
if (state.eat(0x28 /* ( */)) {
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
this.regexp_disjunction(state);
if (state.eat(0x29 /* ) */)) {
return true
if (state.eat(0x3F /* ? */)) {
if (this.options.ecmaVersion >= 16) {
var addModifiers = this.regexp_eatModifiers(state);
var hasHyphen = state.eat(0x2D /* - */);
if (addModifiers || hasHyphen) {
for (var i = 0; i < addModifiers.length; i++) {
var modifier = addModifiers.charAt(i);
if (addModifiers.indexOf(modifier, i + 1) > -1) {
state.raise("Duplicate regular expression modifiers");
}
}
if (hasHyphen) {
var removeModifiers = this.regexp_eatModifiers(state);
if (!addModifiers && !removeModifiers && state.current() === 0x3A /* : */) {
state.raise("Invalid regular expression modifiers");
}
for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {
var modifier$1 = removeModifiers.charAt(i$1);
if (
removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 ||
addModifiers.indexOf(modifier$1) > -1
) {
state.raise("Duplicate regular expression modifiers");
}
}
}
}
}
if (state.eat(0x3A /* : */)) {
this.regexp_disjunction(state);
if (state.eat(0x29 /* ) */)) {
return true
}
state.raise("Unterminated group");
}
state.raise("Unterminated group");
}
state.pos = start;
}
Expand All @@ -4235,6 +4327,23 @@
}
return false
};
// RegularExpressionModifiers ::
// [empty]
// RegularExpressionModifiers RegularExpressionModifier
pp$1.regexp_eatModifiers = function(state) {
var modifiers = "";
var ch = 0;
while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) {
modifiers += codePointToString(ch);
state.advance();
}
return modifiers
};
// RegularExpressionModifier :: one of
// `i` `m` `s`
function isRegularExpressionModifier(ch) {
return ch === 0x69 /* i */ || ch === 0x6d /* m */ || ch === 0x73 /* s */
}

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


var version = "8.13.0";
var version = "8.14.0";

Parser.acorn = {
Parser: Parser,
Expand Down
Loading
Loading