| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff 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 | + | ||
| 1 | 13 | ## 8.13.0 (2024-10-16) | |
| 2 | 14 | ||
| 3 | 15 | ### New features | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -403,6 +403,7 @@ export interface ImportDeclaration extends Node { | |||
| 403 | 403 | type: "ImportDeclaration" | |
| 404 | 404 | specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier> | |
| 405 | 405 | source: Literal | |
| 406 | + attributes: Array<ImportAttribute> | ||
| 406 | 407 | } | |
| 407 | 408 | ||
| 408 | 409 | export interface ImportSpecifier extends Node { | |
@@ -421,11 +422,18 @@ export interface ImportNamespaceSpecifier extends Node { | |||
| 421 | 422 | local: Identifier | |
| 422 | 423 | } | |
| 423 | 424 | ||
| 425 | + export interface ImportAttribute extends Node { | ||
| 426 | + type: "ImportAttribute" | ||
| 427 | + key: Identifier | Literal | ||
| 428 | + value: Literal | ||
| 429 | + } | ||
| 430 | + | ||
| 424 | 431 | export interface ExportNamedDeclaration extends Node { | |
| 425 | 432 | type: "ExportNamedDeclaration" | |
| 426 | 433 | declaration?: Declaration | null | |
| 427 | 434 | specifiers: Array<ExportSpecifier> | |
| 428 | 435 | source?: Literal | null | |
| 436 | + attributes: Array<ImportAttribute> | ||
| 429 | 437 | } | |
| 430 | 438 | ||
| 431 | 439 | export interface ExportSpecifier extends Node { | |
@@ -454,6 +462,7 @@ export interface ExportAllDeclaration extends Node { | |||
| 454 | 462 | type: "ExportAllDeclaration" | |
| 455 | 463 | source: Literal | |
| 456 | 464 | exported?: Identifier | Literal | null | |
| 465 | + attributes: Array<ImportAttribute> | ||
| 457 | 466 | } | |
| 458 | 467 | ||
| 459 | 468 | export interface AwaitExpression extends Node { | |
@@ -469,6 +478,7 @@ export interface ChainExpression extends Node { | |||
| 469 | 478 | export interface ImportExpression extends Node { | |
| 470 | 479 | type: "ImportExpression" | |
| 471 | 480 | source: Expression | |
| 481 | + options: Expression | null | ||
| 472 | 482 | } | |
| 473 | 483 | ||
| 474 | 484 | export interface ParenthesizedExpression extends Node { | |
@@ -562,7 +572,7 @@ export type ModuleDeclaration = | |||
| 562 | 572 | | ExportDefaultDeclaration | |
| 563 | 573 | | ExportAllDeclaration | |
| 564 | 574 | ||
| 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 | ||
| 566 | 576 | ||
| 567 | 577 | export function parse(input: string, options: Options): Program | |
| 568 | 578 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -403,6 +403,7 @@ export interface ImportDeclaration extends Node { | |||
| 403 | 403 | type: "ImportDeclaration" | |
| 404 | 404 | specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier> | |
| 405 | 405 | source: Literal | |
| 406 | + attributes: Array<ImportAttribute> | ||
| 406 | 407 | } | |
| 407 | 408 | ||
| 408 | 409 | export interface ImportSpecifier extends Node { | |
@@ -421,11 +422,18 @@ export interface ImportNamespaceSpecifier extends Node { | |||
| 421 | 422 | local: Identifier | |
| 422 | 423 | } | |
| 423 | 424 | ||
| 425 | + export interface ImportAttribute extends Node { | ||
| 426 | + type: "ImportAttribute" | ||
| 427 | + key: Identifier | Literal | ||
| 428 | + value: Literal | ||
| 429 | + } | ||
| 430 | + | ||
| 424 | 431 | export interface ExportNamedDeclaration extends Node { | |
| 425 | 432 | type: "ExportNamedDeclaration" | |
| 426 | 433 | declaration?: Declaration | null | |
| 427 | 434 | specifiers: Array<ExportSpecifier> | |
| 428 | 435 | source?: Literal | null | |
| 436 | + attributes: Array<ImportAttribute> | ||
| 429 | 437 | } | |
| 430 | 438 | ||
| 431 | 439 | export interface ExportSpecifier extends Node { | |
@@ -454,6 +462,7 @@ export interface ExportAllDeclaration extends Node { | |||
| 454 | 462 | type: "ExportAllDeclaration" | |
| 455 | 463 | source: Literal | |
| 456 | 464 | exported?: Identifier | Literal | null | |
| 465 | + attributes: Array<ImportAttribute> | ||
| 457 | 466 | } | |
| 458 | 467 | ||
| 459 | 468 | export interface AwaitExpression extends Node { | |
@@ -469,6 +478,7 @@ export interface ChainExpression extends Node { | |||
| 469 | 478 | export interface ImportExpression extends Node { | |
| 470 | 479 | type: "ImportExpression" | |
| 471 | 480 | source: Expression | |
| 481 | + options: Expression | null | ||
| 472 | 482 | } | |
| 473 | 483 | ||
| 474 | 484 | export interface ParenthesizedExpression extends Node { | |
@@ -562,7 +572,7 @@ export type ModuleDeclaration = | |||
| 562 | 572 | | ExportDefaultDeclaration | |
| 563 | 573 | | ExportAllDeclaration | |
| 564 | 574 | ||
| 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 | ||
| 566 | 576 | ||
| 567 | 577 | export function parse(input: string, options: Options): Program | |
| 568 | 578 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1678,6 +1678,8 @@ | |||
| 1678 | 1678 | this.expectContextual("from"); | |
| 1679 | 1679 | if (this.type !== types$1.string) { this.unexpected(); } | |
| 1680 | 1680 | node.source = this.parseExprAtom(); | |
| 1681 | + if (this.options.ecmaVersion >= 16) | ||
| 1682 | + { node.attributes = this.parseWithClause(); } | ||
| 1681 | 1683 | this.semicolon(); | |
| 1682 | 1684 | return this.finishNode(node, "ExportAllDeclaration") | |
| 1683 | 1685 | }; | |
@@ -1708,6 +1710,8 @@ | |||
| 1708 | 1710 | if (this.eatContextual("from")) { | |
| 1709 | 1711 | if (this.type !== types$1.string) { this.unexpected(); } | |
| 1710 | 1712 | node.source = this.parseExprAtom(); | |
| 1713 | + if (this.options.ecmaVersion >= 16) | ||
| 1714 | + { node.attributes = this.parseWithClause(); } | ||
| 1711 | 1715 | } else { | |
| 1712 | 1716 | for (var i = 0, list = node.specifiers; i < list.length; i += 1) { | |
| 1713 | 1717 | // check for keywords used as local names | |
@@ -1848,6 +1852,8 @@ | |||
| 1848 | 1852 | this.expectContextual("from"); | |
| 1849 | 1853 | node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected(); | |
| 1850 | 1854 | } | |
| 1855 | + if (this.options.ecmaVersion >= 16) | ||
| 1856 | + { node.attributes = this.parseWithClause(); } | ||
| 1851 | 1857 | this.semicolon(); | |
| 1852 | 1858 | return this.finishNode(node, "ImportDeclaration") | |
| 1853 | 1859 | }; | |
@@ -1908,6 +1914,41 @@ | |||
| 1908 | 1914 | return nodes | |
| 1909 | 1915 | }; | |
| 1910 | 1916 | ||
| 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 | + | ||
| 1911 | 1952 | pp$8.parseModuleExportName = function() { | |
| 1912 | 1953 | if (this.options.ecmaVersion >= 13 && this.type === types$1.string) { | |
| 1913 | 1954 | var stringLiteral = this.parseLiteral(this.value); | |
@@ -2975,13 +3016,32 @@ | |||
| 2975 | 3016 | // Parse node.source. | |
| 2976 | 3017 | node.source = this.parseMaybeAssign(); | |
| 2977 | 3018 | ||
| 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 | + } | ||
| 2983 | 3033 | } 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 | + } | ||
| 2985 | 3045 | } | |
| 2986 | 3046 | } | |
| 2987 | 3047 | ||
@@ -3741,6 +3801,9 @@ | |||
| 3741 | 3801 | return newNode | |
| 3742 | 3802 | }; | |
| 3743 | 3803 | ||
| 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 | + | ||
| 3744 | 3807 | // This file contains Unicode properties extracted from the ECMAScript specification. | |
| 3745 | 3808 | // The lists are extracted like so: | |
| 3746 | 3809 | // $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText) | |
@@ -3783,7 +3846,7 @@ | |||
| 3783 | 3846 | var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; | |
| 3784 | 3847 | var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"; | |
| 3785 | 3848 | 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; | ||
| 3787 | 3850 | ||
| 3788 | 3851 | var unicodeScriptValues = { | |
| 3789 | 3852 | 9: ecma9ScriptValues, | |
@@ -4208,12 +4271,41 @@ | |||
| 4208 | 4271 | pp$1.regexp_eatUncapturingGroup = function(state) { | |
| 4209 | 4272 | var start = state.pos; | |
| 4210 | 4273 | 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"); | ||
| 4215 | 4308 | } | |
| 4216 | - state.raise("Unterminated group"); | ||
| 4217 | 4309 | } | |
| 4218 | 4310 | state.pos = start; | |
| 4219 | 4311 | } | |
@@ -4235,6 +4327,23 @@ | |||
| 4235 | 4327 | } | |
| 4236 | 4328 | return false | |
| 4237 | 4329 | }; | |
| 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 | + } | ||
| 4238 | 4347 | ||
| 4239 | 4348 | // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom | |
| 4240 | 4349 | pp$1.regexp_eatExtendedAtom = function(state) { | |
@@ -5990,7 +6099,7 @@ | |||
| 5990 | 6099 | // [walk]: util/walk.js | |
| 5991 | 6100 | ||
| 5992 | 6101 | ||
| 5993 | - var version = "8.13.0"; | ||
| 6102 | + var version = "8.14.0"; | ||
| 5994 | 6103 | ||
| 5995 | 6104 | Parser.acorn = { | |
| 5996 | 6105 | Parser: Parser, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments