meriyah 7.1.2 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -109,76 +109,78 @@ export declare const enum Errors {
109
109
  InvalidExportImportSource = 105,
110
110
  InvalidKeywordAsAlias = 106,
111
111
  InvalidDefaultImport = 107,
112
- TrailingDecorators = 108,
113
- GeneratorConstructor = 109,
114
- AwaitIdentInModuleOrAsyncFunc = 110,
115
- YieldIdentInModule = 111,
116
- HtmlCommentInWebCompat = 112,
117
- StrictInvalidLetInExprPos = 113,
118
- NotAssignableLetArgs = 114,
119
- ForOfLet = 115,
120
- InvalidInvokedBlockBodyArrow = 116,
121
- InvalidAccessedBlockBodyArrow = 117,
122
- UnexpectedStrictReserved = 118,
123
- StrictEvalArguments = 119,
124
- InvalidDecoratorSemicolon = 120,
125
- StrictDelete = 121,
126
- InvalidPatternTail = 122,
127
- AsyncFunctionInSingleStatementContext = 123,
128
- InvalidTernaryYield = 124,
129
- InvalidArrowPostfix = 125,
130
- InvalidObjLitKeyStar = 126,
131
- DeletePrivateField = 127,
132
- InvalidStaticClassFieldConstructor = 128,
133
- InvalidClassFieldConstructor = 129,
134
- InvalidClassFieldArgEval = 130,
135
- InvalidGeneratorFunction = 131,
136
- AsyncRestrictedProd = 132,
137
- UnexpectedCharAfterObjLit = 133,
138
- InvalidObjLitKey = 134,
139
- InvalidKeyToken = 135,
140
- LabelRedeclaration = 136,
141
- InvalidNestedStatement = 137,
142
- UnknownLabel = 138,
143
- InvalidImportTail = 139,
144
- InvalidJSONImportBinding = 140,
145
- ImportNotOneArg = 141,
146
- InvalidImportNew = 142,
147
- InvalidSpreadInImport = 143,
148
- IncompleteArrow = 144,
149
- DuplicateBinding = 145,
150
- DuplicatePrivateIdentifier = 146,
151
- DuplicateExportBinding = 147,
152
- UndeclaredExportedBinding = 148,
153
- UnexpectedPrivateField = 149,
154
- DuplicateLetConstBinding = 150,
155
- CantAssignToValidRHS = 151,
156
- ContinuousNumericSeparator = 152,
157
- TrailingNumericSeparator = 153,
158
- InvalidJSXAttributeValue = 154,
159
- ExpectedJSXClosingTag = 155,
160
- AdjacentJSXElements = 156,
161
- InvalidNonEmptyJSXExpr = 157,
162
- DuplicateIdentifier = 158,
163
- ShadowedCatchClause = 159,
164
- InvalidDotProperty = 160,
165
- UnclosedSpreadElement = 161,
166
- CatchWithoutTry = 162,
167
- FinallyWithoutTry = 163,
168
- UnCorrespondingFragmentTag = 164,
169
- InvalidCoalescing = 165,
170
- OptionalChainingNoTemplate = 166,
171
- OptionalChainingNoSuper = 167,
172
- OptionalChainingNoNew = 168,
173
- ImportMetaOutsideModule = 169,
174
- InvalidLeadingDecorator = 170,
175
- InvalidExportName = 171,
176
- InvalidExportReference = 172,
177
- InvalidSuperPrivate = 173,
178
- InvalidImportMeta = 174,
179
- InvalidEscapedImportMeta = 175,
180
- InvalidAwaitAsIdentifier = 176,
181
- InvalidAwaitInStaticBlock = 177
112
+ InvalidDeferImport = 108,
113
+ InvalidSourceImport = 109,
114
+ TrailingDecorators = 110,
115
+ GeneratorConstructor = 111,
116
+ AwaitIdentInModuleOrAsyncFunc = 112,
117
+ YieldIdentInModule = 113,
118
+ HtmlCommentInWebCompat = 114,
119
+ StrictInvalidLetInExprPos = 115,
120
+ NotAssignableLetArgs = 116,
121
+ ForOfLet = 117,
122
+ InvalidInvokedBlockBodyArrow = 118,
123
+ InvalidAccessedBlockBodyArrow = 119,
124
+ UnexpectedStrictReserved = 120,
125
+ StrictEvalArguments = 121,
126
+ InvalidDecoratorSemicolon = 122,
127
+ StrictDelete = 123,
128
+ InvalidPatternTail = 124,
129
+ AsyncFunctionInSingleStatementContext = 125,
130
+ InvalidTernaryYield = 126,
131
+ InvalidArrowPostfix = 127,
132
+ InvalidObjLitKeyStar = 128,
133
+ DeletePrivateField = 129,
134
+ InvalidStaticClassFieldConstructor = 130,
135
+ InvalidClassFieldConstructor = 131,
136
+ InvalidClassFieldArgEval = 132,
137
+ InvalidGeneratorFunction = 133,
138
+ AsyncRestrictedProd = 134,
139
+ UnexpectedCharAfterObjLit = 135,
140
+ InvalidObjLitKey = 136,
141
+ InvalidKeyToken = 137,
142
+ LabelRedeclaration = 138,
143
+ InvalidNestedStatement = 139,
144
+ UnknownLabel = 140,
145
+ InvalidImportTail = 141,
146
+ InvalidJSONImportBinding = 142,
147
+ ImportNotOneArg = 143,
148
+ InvalidImportNew = 144,
149
+ InvalidSpreadInImport = 145,
150
+ IncompleteArrow = 146,
151
+ DuplicateBinding = 147,
152
+ DuplicatePrivateIdentifier = 148,
153
+ DuplicateExportBinding = 149,
154
+ UndeclaredExportedBinding = 150,
155
+ UnexpectedPrivateField = 151,
156
+ DuplicateLetConstBinding = 152,
157
+ CantAssignToValidRHS = 153,
158
+ ContinuousNumericSeparator = 154,
159
+ TrailingNumericSeparator = 155,
160
+ InvalidJSXAttributeValue = 156,
161
+ ExpectedJSXClosingTag = 157,
162
+ AdjacentJSXElements = 158,
163
+ InvalidNonEmptyJSXExpr = 159,
164
+ DuplicateIdentifier = 160,
165
+ ShadowedCatchClause = 161,
166
+ InvalidDotProperty = 162,
167
+ UnclosedSpreadElement = 163,
168
+ CatchWithoutTry = 164,
169
+ FinallyWithoutTry = 165,
170
+ UnCorrespondingFragmentTag = 166,
171
+ InvalidCoalescing = 167,
172
+ OptionalChainingNoTemplate = 168,
173
+ OptionalChainingNoSuper = 169,
174
+ OptionalChainingNoNew = 170,
175
+ ImportMetaOutsideModule = 171,
176
+ InvalidLeadingDecorator = 172,
177
+ InvalidExportName = 173,
178
+ InvalidExportReference = 174,
179
+ InvalidSuperPrivate = 175,
180
+ InvalidImportMeta = 176,
181
+ InvalidEscapedImportMeta = 177,
182
+ InvalidAwaitAsIdentifier = 178,
183
+ InvalidAwaitInStaticBlock = 179
182
184
  }
183
185
  export declare class ParseError extends SyntaxError implements _Node {
184
186
  start: number;
@@ -106,6 +106,7 @@ export interface ImportExpression extends _Node {
106
106
  type: 'ImportExpression';
107
107
  source: Expression;
108
108
  options?: Expression | null;
109
+ phase?: 'defer' | 'source' | null;
109
110
  }
110
111
  export interface ChainExpression extends _Node {
111
112
  type: 'ChainExpression';
@@ -248,6 +249,7 @@ export interface ImportDeclaration extends _Node {
248
249
  source: StringLiteral;
249
250
  specifiers: ImportClause[];
250
251
  attributes: ImportAttribute[];
252
+ phase?: 'defer' | 'source' | null;
251
253
  }
252
254
  export interface ImportAttribute extends _Node {
253
255
  type: 'ImportAttribute';
@@ -506,7 +508,7 @@ export interface UnaryExpression extends _Node {
506
508
  export interface VariableDeclaration extends _Node {
507
509
  type: 'VariableDeclaration';
508
510
  declarations: VariableDeclarator[];
509
- kind: 'let' | 'const' | 'var';
511
+ kind: 'let' | 'const' | 'var' | 'using' | 'await using';
510
512
  }
511
513
  export interface VariableDeclarator extends _Node {
512
514
  type: 'VariableDeclarator';
@@ -0,0 +1,7 @@
1
+ export declare const enum Features {
2
+ None = 0,
3
+ Decorators = 1,
4
+ ImportDefer = 2,
5
+ ImportSource = 4
6
+ }
7
+ export declare const nextFeatures: number;
@@ -32,11 +32,15 @@ interface NormalizedRanges {
32
32
  end: boolean;
33
33
  range: boolean;
34
34
  }
35
- export type NormalizedOptions = Omit<Options, 'validateRegex' | 'onComment' | 'onToken' | 'ranges'> & {
35
+ export type InternalOptions = Options & {
36
+ features?: number;
37
+ };
38
+ export type NormalizedOptions = Omit<Options, 'validateRegex' | 'onComment' | 'onToken' | 'ranges' | 'next' | 'module' | 'globalReturn'> & {
36
39
  validateRegex: boolean;
37
40
  ranges?: NormalizedRanges;
38
41
  onComment?: OnComment;
39
42
  onToken?: OnToken;
43
+ features: number;
40
44
  };
41
- export declare function normalizeOptions(rawOptions: Options): NormalizedOptions;
45
+ export declare function normalizeOptions(rawOptions: InternalOptions): NormalizedOptions;
42
46
  export {};
@@ -1,7 +1,8 @@
1
1
  import { AssignmentTargetKind, DestructuringKind, Flags, type Location } from '../common.ts';
2
2
  import { Errors } from '../errors.ts';
3
3
  import type * as ESTree from '../estree.ts';
4
- import { type NormalizedOptions, type Options } from '../options.ts';
4
+ import { Features } from '../features.ts';
5
+ import { type InternalOptions, type NormalizedOptions } from '../options.ts';
5
6
  import { Token } from '../token.ts';
6
7
  import { PrivateScope } from './private-scope.ts';
7
8
  import { Scope, type ScopeKind } from './scope.ts';
@@ -11,6 +12,7 @@ export declare class Parser {
11
12
  options: NormalizedOptions;
12
13
  token: Token;
13
14
  flags: Flags;
15
+ features: Features;
14
16
  index: number;
15
17
  line: number;
16
18
  column: number;
@@ -37,7 +39,7 @@ export declare class Parser {
37
39
  start?: Location;
38
40
  decorators: ESTree.Decorator[];
39
41
  };
40
- constructor(source: string, rawOptions?: Options);
42
+ constructor(source: string, rawOptions?: InternalOptions);
41
43
  getToken(): Token;
42
44
  setToken(value: Token, replaceLast?: boolean): Token;
43
45
  get tokenStart(): Location;
@@ -51,5 +53,4 @@ export declare class Parser {
51
53
  createPrivateScopeIfLexical(parent?: PrivateScope): PrivateScope | undefined;
52
54
  cloneIdentifier(original: ESTree.Identifier): ESTree.Identifier;
53
55
  cloneStringLiteral(original: ESTree.StringLiteral): ESTree.StringLiteral;
54
- private cloneLocationInformation;
55
56
  }
@@ -1,4 +1,4 @@
1
1
  import { Context } from './common.ts';
2
2
  import type * as ESTree from './estree.ts';
3
- import { type Options } from './options.ts';
4
- export declare function parseSource(source: string, rawOptions?: Options, context?: Context): ESTree.Program;
3
+ import { type InternalOptions } from './options.ts';
4
+ export declare function parseSource(source: string, rawOptions?: InternalOptions, context?: Context): ESTree.Program;
@@ -139,29 +139,30 @@ export declare const enum Token {
139
139
  AccessorKeyword = 12402,
140
140
  FromKeyword = 209011,
141
141
  OfKeyword = 471156,
142
- EnumKeyword = 86133,
143
- Eval = 537079926,
144
- Arguments = 537079927,
145
- EscapedReserved = -2147483528,
146
- EscapedFutureReserved = -2147483527,
147
- AnyIdentifier = 209018,
148
- PrivateIdentifier = 123,
149
- BigIntLiteral = 134283388,
150
- Coalesce = 276824445,
151
- QuestionMarkPeriod = 67108990,
152
- WhiteSpace = 127,
153
- Illegal = 128,
154
- CarriageReturn = 129,
155
- PrivateField = 130,
156
- Template = 131,
157
- Decorator = 132,
158
- Target = 209029,
159
- Meta = 209030,
160
- LineFeed = 135,
161
- EscapeStart = 136,
162
- JSXText = 137
142
+ UsingKeyword = 209013,
143
+ EnumKeyword = 86134,
144
+ Eval = 537079927,
145
+ Arguments = 537079928,
146
+ EscapedReserved = -2147483527,
147
+ EscapedFutureReserved = -2147483526,
148
+ AnyIdentifier = 209019,
149
+ PrivateIdentifier = 124,
150
+ BigIntLiteral = 134283389,
151
+ Coalesce = 276824446,
152
+ QuestionMarkPeriod = 67108991,
153
+ WhiteSpace = 128,
154
+ Illegal = 129,
155
+ CarriageReturn = 130,
156
+ PrivateField = 131,
157
+ Template = 132,
158
+ Decorator = 133,
159
+ Target = 209030,
160
+ Meta = 209031,
161
+ LineFeed = 136,
162
+ EscapeStart = 137,
163
+ JSXText = 138
163
164
  }
164
165
  export declare const KeywordDescTable: string[];
165
- export declare const descKeywordTable: {
166
- [key: string]: Token;
167
- };
166
+ export declare const descKeywordTable: Map<string, Token>;
167
+ export declare const minKeywordLength: number;
168
+ export declare const maxKeywordLength: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meriyah",
3
- "version": "7.1.2",
3
+ "version": "7.3.0",
4
4
  "description": "A 100% compliant, self-hosted javascript parser with high focus on both performance and stability",
5
5
  "main": "dist/meriyah.cjs",
6
6
  "module": "dist/meriyah.min.mjs",
@@ -11,6 +11,7 @@
11
11
  "exports": {
12
12
  "types": "./dist/types/meriyah.d.ts",
13
13
  "module-sync": "./dist/meriyah.mjs",
14
+ "import": "./dist/meriyah.mjs",
14
15
  "require": "./dist/meriyah.cjs",
15
16
  "default": "./dist/meriyah.mjs"
16
17
  },
@@ -1 +0,0 @@
1
- export declare function getOwnProperty<T>(object: Record<string | number, T>, key: string | number): T | undefined;