meriyah 7.2.0 → 7.3.1

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,80 @@ 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,
184
+ UnexpectedRightBraceInJSXText = 180,
185
+ UnexpectedGreaterThanInJSXText = 181
182
186
  }
183
187
  export declare class ParseError extends SyntaxError implements _Node {
184
188
  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';
@@ -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;
@@ -33,11 +35,15 @@ export declare class Parser {
33
35
  assignable: AssignmentTargetKind;
34
36
  destructible: DestructuringKind;
35
37
  strictReservedRange: [Location, Location] | null;
38
+ firstAwaitLocation: {
39
+ start: Location;
40
+ end: Location;
41
+ } | null;
36
42
  leadingDecorators: {
37
43
  start?: Location;
38
44
  decorators: ESTree.Decorator[];
39
45
  };
40
- constructor(source: string, rawOptions?: Options);
46
+ constructor(source: string, rawOptions?: InternalOptions);
41
47
  getToken(): Token;
42
48
  setToken(value: Token, replaceLast?: boolean): Token;
43
49
  get tokenStart(): Location;
@@ -51,5 +57,4 @@ export declare class Parser {
51
57
  createPrivateScopeIfLexical(parent?: PrivateScope): PrivateScope | undefined;
52
58
  cloneIdentifier(original: ESTree.Identifier): ESTree.Identifier;
53
59
  cloneStringLiteral(original: ESTree.StringLiteral): ESTree.StringLiteral;
54
- private cloneLocationInformation;
55
60
  }
@@ -30,7 +30,7 @@ export declare class Scope {
30
30
  addVarOrBlock(context: Context, name: string, kind: BindingKind, origin: Origin): void;
31
31
  addVarName(context: Context, name: string, kind: BindingKind): void;
32
32
  hasVariable(name: string): boolean;
33
- addBlockName(context: Context, name: string, kind: BindingKind, origin: Origin): void;
33
+ addBlockName(context: Context, name: string, kind: BindingKind, origin?: Origin): void;
34
34
  recordScopeError(type: Errors, ...params: string[]): void;
35
35
  reportScopeError(): void;
36
36
  }
@@ -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;
@@ -163,6 +163,6 @@ export declare const enum Token {
163
163
  JSXText = 138
164
164
  }
165
165
  export declare const KeywordDescTable: string[];
166
- export declare const descKeywordTable: {
167
- [key: string]: Token;
168
- };
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.2.0",
3
+ "version": "7.3.1",
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",
@@ -1 +0,0 @@
1
- export declare function getOwnProperty<T>(object: Record<string | number, T>, key: string | number): T | undefined;