Skip to content

Commit 4b192da

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update acorn to 8.14.0
PR-URL: #55699 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 961cbc9 commit 4b192da

7 files changed

Lines changed: 280 additions & 30 deletions

File tree

‎deps/acorn/acorn/CHANGELOG.md‎

Lines changed: 12 additions & 0 deletions
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‎

Lines changed: 11 additions & 1 deletion
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
exportinterfaceImportSpecifierextendsNode{
@@ -421,11 +422,18 @@ export interface ImportNamespaceSpecifier extends Node {
421422
local: Identifier
422423
}
423424

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

431439
exportinterfaceExportSpecifierextendsNode{
@@ -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
exportinterfaceAwaitExpressionextendsNode{
@@ -469,6 +478,7 @@ export interface ChainExpression extends Node {
469478
exportinterfaceImportExpressionextendsNode{
470479
type: "ImportExpression"
471480
source: Expression
481+
options: Expression|null
472482
}
473483

474484
exportinterfaceParenthesizedExpressionextendsNode{
@@ -562,7 +572,7 @@ export type ModuleDeclaration =
562572
|ExportDefaultDeclaration
563573
|ExportAllDeclaration
564574

565-
exporttypeAnyNode=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+
exporttypeAnyNode=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
exportfunctionparse(input: string,options: Options): Program
568578

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

Lines changed: 11 additions & 1 deletion
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
exportinterfaceImportSpecifierextendsNode{
@@ -421,11 +422,18 @@ export interface ImportNamespaceSpecifier extends Node {
421422
local: Identifier
422423
}
423424

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

431439
exportinterfaceExportSpecifierextendsNode{
@@ -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
exportinterfaceAwaitExpressionextendsNode{
@@ -469,6 +478,7 @@ export interface ChainExpression extends Node {
469478
exportinterfaceImportExpressionextendsNode{
470479
type: "ImportExpression"
471480
source: Expression
481+
options: Expression|null
472482
}
473483

474484
exportinterfaceParenthesizedExpressionextendsNode{
@@ -562,7 +572,7 @@ export type ModuleDeclaration =
562572
|ExportDefaultDeclaration
563573
|ExportAllDeclaration
564574

565-
exporttypeAnyNode=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+
exporttypeAnyNode=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
exportfunctionparse(input: string,options: Options): Program
568578

‎deps/acorn/acorn/dist/acorn.js‎

Lines changed: 122 additions & 13 deletions
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
returnthis.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(vari=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
returnthis.finishNode(node,"ImportDeclaration")
18531859
};
@@ -1908,6 +1914,41 @@
19081914
returnnodes
19091915
};
19101916

1917+
pp$8.parseWithClause=function(){
1918+
varnodes=[];
1919+
if(!this.eat(types$1._with)){
1920+
returnnodes
1921+
}
1922+
this.expect(types$1.braceL);
1923+
varattributeKeys={};
1924+
varfirst=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+
varattr=this.parseImportAttribute();
1932+
varkeyName=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+
returnnodes
1939+
};
1940+
1941+
pp$8.parseImportAttribute=function(){
1942+
varnode=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+
returnthis.finishNode(node,"ImportAttribute")
1950+
};
1951+
19111952
pp$8.parseModuleExportName=function(){
19121953
if(this.options.ecmaVersion>=13&&this.type===types$1.string){
19131954
varstringLiteral=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-
varerrorPos=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+
varerrorPos=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
returnnewNode
37423802
};
37433803

3804+
// This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually!
3805+
varscriptValuesAddedInUnicode="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
varecma11ScriptValues=ecma10ScriptValues+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
37843847
varecma12ScriptValues=ecma11ScriptValues+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
37853848
varecma13ScriptValues=ecma12ScriptValues+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
3786-
varecma14ScriptValues=ecma13ScriptValues+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
3849+
varecma14ScriptValues=ecma13ScriptValues+" "+scriptValuesAddedInUnicode;
37873850

37883851
varunicodeScriptValues={
37893852
9: ecma9ScriptValues,
@@ -4208,12 +4271,41 @@
42084271
pp$1.regexp_eatUncapturingGroup=function(state){
42094272
varstart=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-
returntrue
4274+
if(state.eat(0x3F/* ? */)){
4275+
if(this.options.ecmaVersion>=16){
4276+
varaddModifiers=this.regexp_eatModifiers(state);
4277+
varhasHyphen=state.eat(0x2D/* - */);
4278+
if(addModifiers||hasHyphen){
4279+
for(vari=0;i<addModifiers.length;i++){
4280+
varmodifier=addModifiers.charAt(i);
4281+
if(addModifiers.indexOf(modifier,i+1)>-1){
4282+
state.raise("Duplicate regular expression modifiers");
4283+
}
4284+
}
4285+
if(hasHyphen){
4286+
varremoveModifiers=this.regexp_eatModifiers(state);
4287+
if(!addModifiers&&!removeModifiers&&state.current()===0x3A/* : */){
4288+
state.raise("Invalid regular expression modifiers");
4289+
}
4290+
for(vari$1=0;i$1<removeModifiers.length;i$1++){
4291+
varmodifier$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+
returntrue
4306+
}
4307+
state.raise("Unterminated group");
42154308
}
4216-
state.raise("Unterminated group");
42174309
}
42184310
state.pos=start;
42194311
}
@@ -4235,6 +4327,23 @@
42354327
}
42364328
returnfalse
42374329
};
4330+
// RegularExpressionModifiers ::
4331+
// [empty]
4332+
// RegularExpressionModifiers RegularExpressionModifier
4333+
pp$1.regexp_eatModifiers=function(state){
4334+
varmodifiers="";
4335+
varch=0;
4336+
while((ch=state.current())!==-1&&isRegularExpressionModifier(ch)){
4337+
modifiers+=codePointToString(ch);
4338+
state.advance();
4339+
}
4340+
returnmodifiers
4341+
};
4342+
// RegularExpressionModifier :: one of
4343+
// `i` `m` `s`
4344+
functionisRegularExpressionModifier(ch){
4345+
returnch===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-
varversion="8.13.0";
6102+
varversion="8.14.0";
59946103

59956104
Parser.acorn={
59966105
Parser: Parser,

0 commit comments

Comments
 (0)