@marko/compiler 5.39.13 → 5.39.15

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.
@@ -1,4 +1,4 @@
1
- "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;exports.getMarkoFile = getMarkoFile;var _traverse = _interopRequireDefault(require("@babel/traverse"));
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;exports.getFile = getFile;exports.getProgram = getProgram;var _traverse = _interopRequireDefault(require("@babel/traverse"));
2
2
  var _babelUtils = require("@marko/compiler/babel-utils");
3
3
  var _crypto = require("crypto");
4
4
  var _path = _interopRequireDefault(require("path"));
@@ -15,7 +15,8 @@ var _parser = require("./parser");
15
15
  var _migrate = require("./plugins/migrate");
16
16
  var _transform = require("./plugins/transform");function _getRequireWildcardCache(e) {if ("function" != typeof WeakMap) return null;var r = new WeakMap(),t = new WeakMap();return (_getRequireWildcardCache = function (e) {return e ? t : r;})(e);}function _interopRequireWildcard(e, r) {if (!r && e && e.__esModule) return e;if (null === e || "object" != typeof e && "function" != typeof e) return { default: e };var t = _getRequireWildcardCache(r);if (t && t.has(e)) return t.get(e);var n = { __proto__: null },a = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];}return n.default = e, t && t.set(e, n), n;}
17
17
 
18
- const SOURCE_FILES = new WeakMap();var _default =
18
+ const SOURCE_FILES = new WeakMap();
19
+ let currentFile;var _default =
19
20
 
20
21
  (api, markoOpts) => {
21
22
  api.assertVersion(7);
@@ -61,22 +62,18 @@ const SOURCE_FILES = new WeakMap();var _default =
61
62
  curOpts = opts;
62
63
  },
63
64
  parserOverride(code) {
64
- const prevFS = _config.default.fs;
65
- _config.default.fs = markoOpts.fileSystem;
66
- try {
67
- const file = getMarkoFile(code, curOpts, markoOpts);
68
- const finalAst = t.cloneNode(file.ast, true);
69
- SOURCE_FILES.set(finalAst, file);
70
- return finalAst;
71
- } finally {
72
- _config.default.fs = prevFS;
73
- }
65
+ const file = getMarkoFile(code, curOpts, markoOpts);
66
+ const finalAst = t.cloneNode(file.ast, true);
67
+ SOURCE_FILES.set(finalAst, file);
68
+ return finalAst;
74
69
  },
75
70
  pre(file) {
76
71
  const { buildError: prevBuildError } = file.hub;
77
72
  const { buildCodeFrameError: prevCodeFrameError } = file;
78
73
  const prevFS = _config.default.fs;
74
+ const prevFile = currentFile;
79
75
  _config.default.fs = markoOpts.fileSystem;
76
+ currentFile = file;
80
77
  curOpts = undefined;
81
78
  try {
82
79
  const { ast, metadata } = file;
@@ -114,6 +111,7 @@ const SOURCE_FILES = new WeakMap();var _default =
114
111
  file.path.scope.crawl(); // Ensure all scopes are accurate for subsequent babel plugins
115
112
  } finally {
116
113
  _config.default.fs = prevFS;
114
+ currentFile = prevFile;
117
115
  file.buildCodeFrameError = prevCodeFrameError;
118
116
  file.hub.buildError = prevBuildError;
119
117
  file.markoOpts =
@@ -147,6 +145,22 @@ const SOURCE_FILES = new WeakMap();var _default =
147
145
  };
148
146
  };exports.default = _default;
149
147
 
148
+ function getFile() {
149
+ if (currentFile) {
150
+ return currentFile;
151
+ }
152
+
153
+ throw new Error("Unable to access Marko File outside of a compilation");
154
+ }
155
+
156
+ function getProgram() {
157
+ if (currentFile) {
158
+ return currentFile.path;
159
+ }
160
+
161
+ throw new Error("Unable to access Marko Program outside of a compilation");
162
+ }
163
+
150
164
  function getMarkoFile(code, fileOpts, markoOpts) {
151
165
  const { translator } = markoOpts;
152
166
  let compileCache = markoOpts.cache.get(translator);
@@ -191,129 +205,137 @@ function getMarkoFile(code, fileOpts, markoOpts) {
191
205
  return cached.file;
192
206
  }
193
207
 
194
- const taglibLookup = (0, _taglib.buildLookup)(_path.default.dirname(filename), translator);
195
-
196
- const file = new _file.MarkoFile(fileOpts, {
197
- code,
198
- ast: {
199
- type: "File",
200
- program: {
201
- type: "Program",
202
- sourceType: "module",
203
- body: [],
204
- directives: [],
205
- params: [t.identifier("input")]
208
+ const prevFs = _config.default.fs;
209
+ const prevFile = currentFile;
210
+ _config.default.fs = markoOpts.fileSystem;
211
+
212
+ try {
213
+ const taglibLookup = (0, _taglib.buildLookup)(_path.default.dirname(filename), translator);
214
+ const file = currentFile = new _file.MarkoFile(fileOpts, {
215
+ code,
216
+ ast: {
217
+ type: "File",
218
+ program: {
219
+ type: "Program",
220
+ sourceType: "module",
221
+ body: [],
222
+ directives: [],
223
+ params: [t.identifier("input")]
224
+ }
206
225
  }
207
- }
208
- });
209
-
210
- const meta = file.metadata.marko = {
211
- id,
212
- deps: [],
213
- tags: [],
214
- watchFiles: [],
215
- diagnostics: []
216
- };
226
+ });
217
227
 
218
- file.markoOpts = markoOpts;
219
- file.___taglibLookup = taglibLookup;
220
- file.___getMarkoFile = getMarkoFile;
228
+ const meta = file.metadata.marko = {
229
+ id,
230
+ deps: [],
231
+ tags: [],
232
+ watchFiles: [],
233
+ diagnostics: []
234
+ };
221
235
 
222
- file.___compileStage = "parse";
223
- (0, _parser.parseMarko)(file);
236
+ file.markoOpts = markoOpts;
237
+ file.___taglibLookup = taglibLookup;
238
+ file.___getMarkoFile = getMarkoFile;
224
239
 
225
- if (isSource) {
226
- return file;
227
- }
240
+ file.___compileStage = "parse";
241
+ (0, _parser.parseMarko)(file);
242
+
243
+ if (isSource) {
244
+ return file;
245
+ }
228
246
 
229
- file.path.scope.crawl(); // Initialize bindings.
247
+ file.path.scope.crawl(); // Initialize bindings.
230
248
 
231
- const rootMigrators = [];
232
- for (const id in taglibLookup.taglibsById) {
233
- for (const migrator of taglibLookup.taglibsById[id].migrators) {
234
- addPlugin(meta, rootMigrators, migrator);
249
+ const rootMigrators = [];
250
+ for (const id in taglibLookup.taglibsById) {
251
+ for (const migrator of taglibLookup.taglibsById[id].migrators) {
252
+ addPlugin(meta, rootMigrators, migrator);
253
+ }
235
254
  }
236
- }
237
255
 
238
- rootMigrators.push(_migrate.visitor);
239
- file.___compileStage = "migrate";
240
- traverseAll(file, rootMigrators);
241
-
242
- if (file.___hasParseErrors) {
243
- if (markoOpts.errorRecovery) {
244
- t.traverseFast(file.path.node, (node) => {
245
- if (node.type === "MarkoParseError") {
246
- (0, _babelUtils.diagnosticError)(file.path, {
247
- label: node.label,
248
- loc: node.errorLoc || node.loc
249
- });
250
- }
251
- });
252
- } else {
253
- let errors = [];
254
- t.traverseFast(file.path.node, (node) => {
255
- if (node.type === "MarkoParseError") {
256
- errors.push(
257
- (0, _buildCodeFrame.buildCodeFrameError)(
258
- file.opts.filename,
259
- file.code,
260
- node.errorLoc || node.loc,
261
- node.label
262
- )
263
- );
264
- }
265
- });
256
+ rootMigrators.push(_migrate.visitor);
257
+ file.___compileStage = "migrate";
258
+ traverseAll(file, rootMigrators);
259
+
260
+ if (file.___hasParseErrors) {
261
+ if (markoOpts.errorRecovery) {
262
+ t.traverseFast(file.path.node, (node) => {
263
+ if (node.type === "MarkoParseError") {
264
+ (0, _babelUtils.diagnosticError)(file.path, {
265
+ label: node.label,
266
+ loc: node.errorLoc || node.loc
267
+ });
268
+ }
269
+ });
270
+ } else {
271
+ let errors = [];
272
+ t.traverseFast(file.path.node, (node) => {
273
+ if (node.type === "MarkoParseError") {
274
+ errors.push(
275
+ (0, _buildCodeFrame.buildCodeFrameError)(
276
+ file.opts.filename,
277
+ file.code,
278
+ node.errorLoc || node.loc,
279
+ node.label
280
+ )
281
+ );
282
+ }
283
+ });
266
284
 
267
- (0, _mergeErrors.default)(errors);
285
+ (0, _mergeErrors.default)(errors);
286
+ }
268
287
  }
269
- }
270
288
 
271
- if (isMigrate) {
272
- return file;
273
- }
289
+ if (isMigrate) {
290
+ return file;
291
+ }
274
292
 
275
- const rootTransformers = [];
276
- for (const id in taglibLookup.taglibsById) {
277
- for (const transformer of taglibLookup.taglibsById[id].transformers) {
278
- addPlugin(meta, rootTransformers, transformer);
293
+ const rootTransformers = [];
294
+ for (const id in taglibLookup.taglibsById) {
295
+ for (const transformer of taglibLookup.taglibsById[id].transformers) {
296
+ addPlugin(meta, rootTransformers, transformer);
297
+ }
279
298
  }
280
- }
281
299
 
282
- rootTransformers.push(_transform.visitor);
283
- if (translator.transform) {
284
- rootTransformers.push(translator.transform);
285
- }
286
- file.___compileStage = "transform";
287
- traverseAll(file, rootTransformers);
300
+ rootTransformers.push(_transform.visitor);
301
+ if (translator.transform) {
302
+ rootTransformers.push(translator.transform);
303
+ }
304
+ file.___compileStage = "transform";
305
+ traverseAll(file, rootTransformers);
288
306
 
289
- for (const taglibId in taglibLookup.taglibsById) {
290
- const { filePath } = taglibLookup.taglibsById[taglibId];
307
+ for (const taglibId in taglibLookup.taglibsById) {
308
+ const { filePath } = taglibLookup.taglibsById[taglibId];
291
309
 
292
- if (
293
- filePath[filePath.length - 5] === "." &&
294
- filePath.endsWith("marko.json"))
295
- {
296
- meta.watchFiles.push(filePath);
310
+ if (
311
+ filePath[filePath.length - 5] === "." &&
312
+ filePath.endsWith("marko.json"))
313
+ {
314
+ meta.watchFiles.push(filePath);
315
+ }
297
316
  }
298
- }
299
317
 
300
- compileCache.set(cacheKey, {
301
- time: Date.now(),
302
- file,
303
- contentHash
304
- });
305
-
306
- if (translator.analyze) {
307
- try {
308
- file.___compileStage = "analyze";
309
- traverseAll(file, translator.analyze);
310
- } catch (e) {
311
- compileCache.delete(cacheKey);
312
- throw e;
318
+ compileCache.set(cacheKey, {
319
+ time: Date.now(),
320
+ file,
321
+ contentHash
322
+ });
323
+
324
+ if (translator.analyze) {
325
+ try {
326
+ file.___compileStage = "analyze";
327
+ traverseAll(file, translator.analyze);
328
+ } catch (e) {
329
+ compileCache.delete(cacheKey);
330
+ throw e;
331
+ }
313
332
  }
314
- }
315
333
 
316
- return file;
334
+ return file;
335
+ } finally {
336
+ _config.default.fs = prevFs;
337
+ currentFile = prevFile;
338
+ }
317
339
  }
318
340
 
319
341
  function shallowClone(data) {
@@ -1,6 +1,6 @@
1
1
  "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
2
2
  var babelTypes = _interopRequireWildcard(require("@babel/types"));
3
- var _utils = _interopRequireDefault(require("@babel/types/lib/definitions/utils"));
3
+ var definitionUtils = _interopRequireWildcard(require("@babel/types/lib/definitions/utils"));
4
4
  var generatedValidators = _interopRequireWildcard(require("@babel/types/lib/validators/generated"));
5
5
  var referencedValidators = _interopRequireWildcard(require("@babel/types/lib/validators/isReferenced"));
6
6
  var _validate = _interopRequireDefault(require("@babel/types/lib/validators/validate"));
@@ -21,7 +21,7 @@ getBindingIdentifiers.keys.MarkoTag = ["var"];
21
21
  getBindingIdentifiers.keys.MarkoTagBody = ["params"];
22
22
 
23
23
  _definitions.MARKO_TYPES.forEach((typeName) => {
24
- (0, _utils.default)(typeName, _definitions.default[typeName]);
24
+ definitionUtils.default(typeName, _definitions.default[typeName]);
25
25
  });
26
26
 
27
27
  babelTypes.NODE_FIELDS.Program.params =
@@ -65,6 +65,17 @@ referencedValidators.default = (node, parent, grandparent) => {
65
65
  }
66
66
  };
67
67
 
68
+ for (const { types, set } of definitionUtils.allExpandedTypes || []) {
69
+ for (const type of types) {
70
+ const aliases = FLIPPED_ALIAS_KEYS[type];
71
+ if (aliases) {
72
+ aliases.forEach(set.add, set);
73
+ } else {
74
+ set.add(type);
75
+ }
76
+ }
77
+ }
78
+
68
79
  function assert(typeName, node, opts) {
69
80
  if (!is(typeName, node, opts)) {
70
81
  throw new Error(
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports._clearDefaults = _clearDefaults;exports.compile = compile;exports.compileFile = compileFile;exports.compileFileSync = compileFileSync;exports.compileSync = compileSync;exports.configure = configure;exports.getRuntimeEntryFiles = getRuntimeEntryFiles;exports.types = exports.taglib = exports.globalConfig = void 0;var _types = _interopRequireWildcard(require("./babel-types"));exports.types = _types;
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports._clearDefaults = _clearDefaults;exports.compile = compile;exports.compileFile = compileFile;exports.compileFileSync = compileFileSync;exports.compileSync = compileSync;exports.configure = configure;exports.getProgram = exports.getFile = void 0;exports.getRuntimeEntryFiles = getRuntimeEntryFiles;exports.types = exports.taglib = exports.globalConfig = void 0;var _types = _interopRequireWildcard(require("./babel-types"));exports.types = _types;
2
2
  var babel = _interopRequireWildcard(require("@babel/core"));
3
3
  var _pluginSyntaxTypescript = _interopRequireDefault(require("@babel/plugin-syntax-typescript"));
4
4
  var _pluginTransformModulesCommonjs = _interopRequireDefault(require("@babel/plugin-transform-modules-commonjs"));
@@ -6,7 +6,7 @@ var _pluginTransformTypescript = _interopRequireDefault(require("@babel/plugin-t
6
6
  var _babelUtils = require("@marko/compiler/babel-utils");
7
7
  var _path = _interopRequireDefault(require("path"));
8
8
 
9
- var _babelPlugin = _interopRequireDefault(require("./babel-plugin"));
9
+ var _babelPlugin = _interopRequireWildcard(require("./babel-plugin"));exports.getFile = _babelPlugin.getFile;exports.getProgram = _babelPlugin.getProgram;
10
10
  var _config = _interopRequireDefault(require("./config"));
11
11
  var taglib = _interopRequireWildcard(require("./taglib"));exports.taglib = taglib;
12
12
  var _buildCodeFrame = require("./util/build-code-frame");
@@ -15,6 +15,7 @@ var _shouldOptimize = _interopRequireDefault(require("./util/should-optimize"));
15
15
  var _tryLoadTranslator = _interopRequireDefault(require("./util/try-load-translator"));function _getRequireWildcardCache(e) {if ("function" != typeof WeakMap) return null;var r = new WeakMap(),t = new WeakMap();return (_getRequireWildcardCache = function (e) {return e ? t : r;})(e);}function _interopRequireWildcard(e, r) {if (!r && e && e.__esModule) return e;if (null === e || "object" != typeof e && "function" != typeof e) return { default: e };var t = _getRequireWildcardCache(r);if (t && t.has(e)) return t.get(e);var n = { __proto__: null },a = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];}return n.default = e, t && t.set(e, n), n;}
16
16
 
17
17
 
18
+
18
19
  const CWD = process.cwd();
19
20
 
20
21
  let globalConfig = exports.globalConfig = { ..._config.default };
@@ -746,6 +746,7 @@ export class NodePath<T = Node> {
746
746
  getAllNextSiblings(): NodePath[];
747
747
 
748
748
  get<K extends keyof T>(key: K, context?: boolean | TraversalContext): NodePathResult<T[K]>;
749
+ get<P extends string>(path: P, context?: boolean | TraversalContext): NodePathResult<ImplGetRecursive<T, P>>;
749
750
 
750
751
 
751
752
  getBindingIdentifiers(duplicates: true): Record<string, t.Identifier[]>;
@@ -1488,6 +1489,27 @@ export interface TraversalContext<S = unknown> {
1488
1489
  opts: TraverseOptions;
1489
1490
  }
1490
1491
 
1492
+ // Based on `GetFieldType`s from `@types/lodash/common/object.d.ts`:
1493
+ // dprint-ignore
1494
+ type ImplGetOfArray<T extends readonly unknown[], K extends string> =
1495
+ K extends `${infer N extends number}` ? T[N]
1496
+ : K extends keyof T ? T[K]
1497
+ : never;
1498
+
1499
+ // dprint-ignore
1500
+ type ImplGetByKey<T, K extends string>
1501
+ = T extends readonly unknown[] ? ImplGetOfArray<T, K>
1502
+ : K extends keyof T ? T[K]
1503
+ : K extends `${infer N extends number}`
1504
+ ? N extends keyof T ? T[N] : never
1505
+ : never;
1506
+
1507
+ // dprint-ignore
1508
+ type ImplGetRecursive<T, K extends string>
1509
+ = K extends `${infer L}.${infer R}`
1510
+ ? ImplGetRecursive<ImplGetByKey<T, L>, R>
1511
+ : ImplGetByKey<T, K>;
1512
+
1491
1513
  export type NodePathResult<T> =
1492
1514
  | (Extract<T, Node | null | undefined> extends never ? never : NodePath<Extract<T, Node | null | undefined>>)
1493
1515
  | (T extends Array<Node | null | undefined> ? Array<NodePath<T[number]>> : never);
package/dist/types.d.ts CHANGED
@@ -46,7 +46,7 @@ interface BaseNode {
46
46
  extra?: NodeExtra;
47
47
  }
48
48
 
49
- export type Node = Accessor | AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | Binary | BinaryExpression | BindExpression | Block | BlockParent | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | Class | ClassAccessorProperty | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | CompletionStatement | Conditional | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | Declaration | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBody | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | Expression | ExpressionStatement | ExpressionWrapper | File | Flow | FlowBaseAnnotation | FlowDeclaration | FlowPredicate | FlowType | For | ForInStatement | ForOfStatement | ForStatement | ForXStatement | Function | FunctionDeclaration | FunctionExpression | FunctionParent | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Immutable | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportExpression | ImportNamespaceSpecifier | ImportOrExportDeclaration | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSX | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LVal | LabeledStatement | Literal | LogicalExpression | Loop | Marko | MarkoAttribute | MarkoCDATA | MarkoClass | MarkoComment | MarkoDeclaration | MarkoDocumentType | MarkoParseError | MarkoPlaceholder | MarkoScriptlet | MarkoSpreadAttribute | MarkoTag | MarkoTagBody | MarkoText | MemberExpression | MetaProperty | Method | Miscellaneous | MixedTypeAnnotation | ModuleDeclaration | ModuleExpression | ModuleSpecifier | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteral | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMember | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | Pattern | PatternLike | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | Private | PrivateName | Program | Property | Pureish | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RegexLiteral | RestElement | RestProperty | ReturnStatement | Scopable | Scope | SequenceExpression | SpreadElement | SpreadProperty | Standardized | Statement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBaseType | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEntityName | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSSatisfiesExpression | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeElement | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | Terminatorless | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeScript | TypeofTypeAnnotation | UnaryExpression | UnaryLike | UnionTypeAnnotation | UpdateExpression | UserWhitespacable | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidTypeAnnotation | While | WhileStatement | WithStatement | YieldExpression;
49
+ export type Node = Accessor | AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | Binary | BinaryExpression | BindExpression | Block | BlockParent | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | Class | ClassAccessorProperty | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | CompletionStatement | Conditional | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | Declaration | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBody | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | Expression | ExpressionStatement | ExpressionWrapper | File | Flow | FlowBaseAnnotation | FlowDeclaration | FlowPredicate | FlowType | For | ForInStatement | ForOfStatement | ForStatement | ForXStatement | Function | FunctionDeclaration | FunctionExpression | FunctionParent | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Immutable | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportExpression | ImportNamespaceSpecifier | ImportOrExportDeclaration | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSX | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LVal | LabeledStatement | Literal | LogicalExpression | Loop | Marko | MarkoAttribute | MarkoCDATA | MarkoClass | MarkoComment | MarkoDeclaration | MarkoDocumentType | MarkoParseError | MarkoPlaceholder | MarkoScriptlet | MarkoSpreadAttribute | MarkoTag | MarkoTagBody | MarkoText | MemberExpression | MetaProperty | Method | Miscellaneous | MixedTypeAnnotation | ModuleDeclaration | ModuleExpression | ModuleSpecifier | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteral | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMember | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | Pattern | PatternLike | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | Private | PrivateName | Program | Property | Pureish | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RegexLiteral | RestElement | RestProperty | ReturnStatement | Scopable | Scope | SequenceExpression | SpreadElement | SpreadProperty | Standardized | Statement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBaseType | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEntityName | TSEnumBody | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSSatisfiesExpression | TSStringKeyword | TSSymbolKeyword | TSTemplateLiteralType | TSThisType | TSTupleType | TSType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeElement | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | Terminatorless | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeScript | TypeofTypeAnnotation | UnaryExpression | UnaryLike | UnionTypeAnnotation | UpdateExpression | UserWhitespacable | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidTypeAnnotation | While | WhileStatement | WithStatement | YieldExpression;
50
50
 
51
51
  export interface ArrayExpression extends BaseNode {
52
52
  type: "ArrayExpression";
@@ -665,6 +665,7 @@ export interface ClassPrivateProperty extends BaseNode {
665
665
  decorators: Array<Decorator> | null;
666
666
  static: boolean;
667
667
  definite: boolean | null;
668
+ optional: boolean | null;
668
669
  readonly: boolean | null;
669
670
  typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null;
670
671
  variance: Variance | null;
@@ -700,6 +701,12 @@ export interface StaticBlock extends BaseNode {
700
701
  body: Array<Statement>;
701
702
  }
702
703
 
704
+ export interface ImportAttribute extends BaseNode {
705
+ type: "ImportAttribute";
706
+ key: Identifier | StringLiteral;
707
+ value: StringLiteral;
708
+ }
709
+
703
710
  export interface AnyTypeAnnotation extends BaseNode {
704
711
  type: "AnyTypeAnnotation";
705
712
  }
@@ -1150,7 +1157,8 @@ export interface JSXOpeningElement extends BaseNode {
1150
1157
  name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName;
1151
1158
  attributes: Array<JSXAttribute | JSXSpreadAttribute>;
1152
1159
  selfClosing: boolean;
1153
- typeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation | null;
1160
+ typeArguments: TypeParameterInstantiation | null;
1161
+ typeParameters: TSTypeParameterInstantiation | null;
1154
1162
  }
1155
1163
 
1156
1164
  export interface JSXSpreadAttribute extends BaseNode {
@@ -1206,12 +1214,6 @@ export interface BindExpression extends BaseNode {
1206
1214
  callee: Expression;
1207
1215
  }
1208
1216
 
1209
- export interface ImportAttribute extends BaseNode {
1210
- type: "ImportAttribute";
1211
- key: Identifier | StringLiteral;
1212
- value: StringLiteral;
1213
- }
1214
-
1215
1217
  export interface Decorator extends BaseNode {
1216
1218
  type: "Decorator";
1217
1219
  expression: Expression;
@@ -1330,7 +1332,7 @@ export interface TSPropertySignature extends BaseNode {
1330
1332
  key: Expression;
1331
1333
  typeAnnotation: TSTypeAnnotation | null;
1332
1334
  computed: boolean;
1333
- kind: "get" | "set";
1335
+ kind: "get" | "set" | null;
1334
1336
  optional: boolean | null;
1335
1337
  readonly: boolean | null;
1336
1338
  }
@@ -1525,6 +1527,12 @@ export interface TSMappedType extends BaseNode {
1525
1527
  readonly: true | false | "+" | "-" | null;
1526
1528
  }
1527
1529
 
1530
+ export interface TSTemplateLiteralType extends BaseNode {
1531
+ type: "TSTemplateLiteralType";
1532
+ quasis: Array<TemplateElement>;
1533
+ types: Array<TSType>;
1534
+ }
1535
+
1528
1536
  export interface TSLiteralType extends BaseNode {
1529
1537
  type: "TSLiteralType";
1530
1538
  literal: NumericLiteral | StringLiteral | BooleanLiteral | BigIntLiteral | TemplateLiteral | UnaryExpression;
@@ -1582,10 +1590,16 @@ export interface TSTypeAssertion extends BaseNode {
1582
1590
  expression: Expression;
1583
1591
  }
1584
1592
 
1593
+ export interface TSEnumBody extends BaseNode {
1594
+ type: "TSEnumBody";
1595
+ members: Array<TSEnumMember>;
1596
+ }
1597
+
1585
1598
  export interface TSEnumDeclaration extends BaseNode {
1586
1599
  type: "TSEnumDeclaration";
1587
1600
  id: Identifier;
1588
1601
  members: Array<TSEnumMember>;
1602
+ body: TSEnumBody | null;
1589
1603
  const: boolean | null;
1590
1604
  declare: boolean | null;
1591
1605
  initializer: Expression | null;
@@ -1777,7 +1791,7 @@ export type RestProperty = RestElement;
1777
1791
  */
1778
1792
  export type SpreadProperty = SpreadElement;
1779
1793
 
1780
- export type Standardized = ArrayExpression | AssignmentExpression | BinaryExpression | InterpreterDirective | Directive | DirectiveLiteral | BlockStatement | BreakStatement | CallExpression | CatchClause | ConditionalExpression | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | File | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Identifier | IfStatement | LabeledStatement | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | Program | ObjectExpression | ObjectMethod | ObjectProperty | RestElement | ReturnStatement | SequenceExpression | ParenthesizedExpression | SwitchCase | SwitchStatement | ThisExpression | ThrowStatement | TryStatement | UnaryExpression | UpdateExpression | VariableDeclaration | VariableDeclarator | WhileStatement | WithStatement | AssignmentPattern | ArrayPattern | ArrowFunctionExpression | ClassBody | ClassExpression | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ExportSpecifier | ForOfStatement | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | ImportExpression | MetaProperty | ClassMethod | ObjectPattern | SpreadElement | Super | TaggedTemplateExpression | TemplateElement | TemplateLiteral | YieldExpression | AwaitExpression | Import | BigIntLiteral | ExportNamespaceSpecifier | OptionalMemberExpression | OptionalCallExpression | ClassProperty | ClassAccessorProperty | ClassPrivateProperty | ClassPrivateMethod | PrivateName | StaticBlock;
1794
+ export type Standardized = ArrayExpression | AssignmentExpression | BinaryExpression | InterpreterDirective | Directive | DirectiveLiteral | BlockStatement | BreakStatement | CallExpression | CatchClause | ConditionalExpression | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | File | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Identifier | IfStatement | LabeledStatement | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | Program | ObjectExpression | ObjectMethod | ObjectProperty | RestElement | ReturnStatement | SequenceExpression | ParenthesizedExpression | SwitchCase | SwitchStatement | ThisExpression | ThrowStatement | TryStatement | UnaryExpression | UpdateExpression | VariableDeclaration | VariableDeclarator | WhileStatement | WithStatement | AssignmentPattern | ArrayPattern | ArrowFunctionExpression | ClassBody | ClassExpression | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ExportSpecifier | ForOfStatement | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | ImportExpression | MetaProperty | ClassMethod | ObjectPattern | SpreadElement | Super | TaggedTemplateExpression | TemplateElement | TemplateLiteral | YieldExpression | AwaitExpression | Import | BigIntLiteral | ExportNamespaceSpecifier | OptionalMemberExpression | OptionalCallExpression | ClassProperty | ClassAccessorProperty | ClassPrivateProperty | ClassPrivateMethod | PrivateName | StaticBlock | ImportAttribute;
1781
1795
  export type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | ConditionalExpression | FunctionExpression | Identifier | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | ObjectExpression | SequenceExpression | ParenthesizedExpression | ThisExpression | UnaryExpression | UpdateExpression | ArrowFunctionExpression | ClassExpression | ImportExpression | MetaProperty | Super | TaggedTemplateExpression | TemplateLiteral | YieldExpression | AwaitExpression | Import | BigIntLiteral | OptionalMemberExpression | OptionalCallExpression | TypeCastExpression | JSXElement | JSXFragment | BindExpression | DoExpression | RecordExpression | TupleExpression | DecimalLiteral | ModuleExpression | TopicReference | PipelineTopicExpression | PipelineBareFunction | PipelinePrimaryTopicReference | TSInstantiationExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | MarkoParseError;
1782
1796
  export type Binary = BinaryExpression | LogicalExpression;
1783
1797
  export type Scopable = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ClassExpression | ClassDeclaration | ForOfStatement | ClassMethod | ClassPrivateMethod | StaticBlock | TSModuleBlock;
@@ -1795,7 +1809,7 @@ export type ForXStatement = ForInStatement | ForOfStatement;
1795
1809
  export type Function = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod | ClassPrivateMethod;
1796
1810
  export type FunctionParent = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod | ClassPrivateMethod | StaticBlock | TSModuleBlock;
1797
1811
  export type Pureish = FunctionDeclaration | FunctionExpression | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | ArrowFunctionExpression | BigIntLiteral | DecimalLiteral;
1798
- export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | InterfaceDeclaration | OpaqueType | TypeAlias | EnumDeclaration | TSDeclareFunction | TSInterfaceDeclaration | TSTypeAliasDeclaration | TSEnumDeclaration | TSModuleDeclaration;
1812
+ export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | InterfaceDeclaration | OpaqueType | TypeAlias | EnumDeclaration | TSDeclareFunction | TSInterfaceDeclaration | TSTypeAliasDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSImportEqualsDeclaration;
1799
1813
  export type PatternLike = Identifier | RestElement | AssignmentPattern | ArrayPattern | ObjectPattern | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression;
1800
1814
  export type LVal = Identifier | MemberExpression | RestElement | AssignmentPattern | ArrayPattern | ObjectPattern | TSParameterProperty | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression;
1801
1815
  export type TSEntityName = Identifier | TSQualifiedName;
@@ -1822,10 +1836,10 @@ export type EnumBody = EnumBooleanBody | EnumNumberBody | EnumStringBody | EnumS
1822
1836
  export type EnumMember = EnumBooleanMember | EnumNumberMember | EnumStringMember | EnumDefaultedMember;
1823
1837
  export type JSX = JSXAttribute | JSXClosingElement | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXSpreadChild | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXSpreadAttribute | JSXText | JSXFragment | JSXOpeningFragment | JSXClosingFragment;
1824
1838
  export type Miscellaneous = Noop | Placeholder | V8IntrinsicIdentifier;
1825
- export type TypeScript = TSParameterProperty | TSDeclareFunction | TSDeclareMethod | TSQualifiedName | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSPropertySignature | TSMethodSignature | TSIndexSignature | TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSFunctionType | TSConstructorType | TSTypeReference | TSTypePredicate | TSTypeQuery | TSTypeLiteral | TSArrayType | TSTupleType | TSOptionalType | TSRestType | TSNamedTupleMember | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSParenthesizedType | TSTypeOperator | TSIndexedAccessType | TSMappedType | TSLiteralType | TSExpressionWithTypeArguments | TSInterfaceDeclaration | TSInterfaceBody | TSTypeAliasDeclaration | TSInstantiationExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSEnumDeclaration | TSEnumMember | TSModuleDeclaration | TSModuleBlock | TSImportType | TSImportEqualsDeclaration | TSExternalModuleReference | TSNonNullExpression | TSExportAssignment | TSNamespaceExportDeclaration | TSTypeAnnotation | TSTypeParameterInstantiation | TSTypeParameterDeclaration | TSTypeParameter;
1839
+ export type TypeScript = TSParameterProperty | TSDeclareFunction | TSDeclareMethod | TSQualifiedName | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSPropertySignature | TSMethodSignature | TSIndexSignature | TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSFunctionType | TSConstructorType | TSTypeReference | TSTypePredicate | TSTypeQuery | TSTypeLiteral | TSArrayType | TSTupleType | TSOptionalType | TSRestType | TSNamedTupleMember | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSParenthesizedType | TSTypeOperator | TSIndexedAccessType | TSMappedType | TSTemplateLiteralType | TSLiteralType | TSExpressionWithTypeArguments | TSInterfaceDeclaration | TSInterfaceBody | TSTypeAliasDeclaration | TSInstantiationExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSEnumBody | TSEnumDeclaration | TSEnumMember | TSModuleDeclaration | TSModuleBlock | TSImportType | TSImportEqualsDeclaration | TSExternalModuleReference | TSNonNullExpression | TSExportAssignment | TSNamespaceExportDeclaration | TSTypeAnnotation | TSTypeParameterInstantiation | TSTypeParameterDeclaration | TSTypeParameter;
1826
1840
  export type TSTypeElement = TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSPropertySignature | TSMethodSignature | TSIndexSignature;
1827
- export type TSType = TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSFunctionType | TSConstructorType | TSTypeReference | TSTypePredicate | TSTypeQuery | TSTypeLiteral | TSArrayType | TSTupleType | TSOptionalType | TSRestType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSParenthesizedType | TSTypeOperator | TSIndexedAccessType | TSMappedType | TSLiteralType | TSExpressionWithTypeArguments | TSImportType;
1828
- export type TSBaseType = TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSLiteralType;
1841
+ export type TSType = TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSFunctionType | TSConstructorType | TSTypeReference | TSTypePredicate | TSTypeQuery | TSTypeLiteral | TSArrayType | TSTupleType | TSOptionalType | TSRestType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSParenthesizedType | TSTypeOperator | TSIndexedAccessType | TSMappedType | TSTemplateLiteralType | TSLiteralType | TSExpressionWithTypeArguments | TSImportType;
1842
+ export type TSBaseType = TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSTemplateLiteralType | TSLiteralType;
1829
1843
  export type ModuleDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration;
1830
1844
  export type Marko = MarkoParseError | MarkoDocumentType | MarkoDeclaration | MarkoCDATA | MarkoComment | MarkoText | MarkoPlaceholder | MarkoScriptlet | MarkoClass | MarkoAttribute | MarkoSpreadAttribute | MarkoTagBody | MarkoTag;
1831
1845
  export type Scope = MarkoTagBody;
@@ -1975,6 +1989,7 @@ export function classPrivateProperty(key: PrivateName, value?: Expression | null
1975
1989
  export function classPrivateMethod(kind: "get" | "set" | "method" | undefined, key: PrivateName, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, _static?: boolean): ClassPrivateMethod;
1976
1990
  export function privateName(id: Identifier): PrivateName;
1977
1991
  export function staticBlock(body: Array<Statement>): StaticBlock;
1992
+ export function importAttribute(key: Identifier | StringLiteral, value: StringLiteral): ImportAttribute;
1978
1993
  export function anyTypeAnnotation(): AnyTypeAnnotation;
1979
1994
  export function arrayTypeAnnotation(elementType: FlowType): ArrayTypeAnnotation;
1980
1995
  export function booleanTypeAnnotation(): BooleanTypeAnnotation;
@@ -2060,7 +2075,6 @@ export function placeholder(expectedNode: "Identifier" | "StringLiteral" | "Expr
2060
2075
  export function v8IntrinsicIdentifier(name: string): V8IntrinsicIdentifier;
2061
2076
  export function argumentPlaceholder(): ArgumentPlaceholder;
2062
2077
  export function bindExpression(object: Expression, callee: Expression): BindExpression;
2063
- export function importAttribute(key: Identifier | StringLiteral, value: StringLiteral): ImportAttribute;
2064
2078
  export function decorator(expression: Expression): Decorator;
2065
2079
  export function doExpression(body: BlockStatement, async?: boolean): DoExpression;
2066
2080
  export function exportDefaultSpecifier(exported: Identifier): ExportDefaultSpecifier;
@@ -2114,6 +2128,7 @@ export function tsParenthesizedType(typeAnnotation: TSType): TSParenthesizedType
2114
2128
  export function tsTypeOperator(typeAnnotation: TSType): TSTypeOperator;
2115
2129
  export function tsIndexedAccessType(objectType: TSType, indexType: TSType): TSIndexedAccessType;
2116
2130
  export function tsMappedType(typeParameter: TSTypeParameter, typeAnnotation?: TSType | null, nameType?: TSType | null): TSMappedType;
2131
+ export function tsTemplateLiteralType(quasis: Array<TemplateElement>, types: Array<TSType>): TSTemplateLiteralType;
2117
2132
  export function tsLiteralType(literal: NumericLiteral | StringLiteral | BooleanLiteral | BigIntLiteral | TemplateLiteral | UnaryExpression): TSLiteralType;
2118
2133
  export function tsExpressionWithTypeArguments(expression: TSEntityName, typeParameters?: TSTypeParameterInstantiation | null): TSExpressionWithTypeArguments;
2119
2134
  export function tsInterfaceDeclaration(id: Identifier, typeParameters: TSTypeParameterDeclaration | null | undefined, _extends: Array<TSExpressionWithTypeArguments> | null | undefined, body: TSInterfaceBody): TSInterfaceDeclaration;
@@ -2123,6 +2138,7 @@ export function tsInstantiationExpression(expression: Expression, typeParameters
2123
2138
  export function tsAsExpression(expression: Expression, typeAnnotation: TSType): TSAsExpression;
2124
2139
  export function tsSatisfiesExpression(expression: Expression, typeAnnotation: TSType): TSSatisfiesExpression;
2125
2140
  export function tsTypeAssertion(typeAnnotation: TSType, expression: Expression): TSTypeAssertion;
2141
+ export function tsEnumBody(members: Array<TSEnumMember>): TSEnumBody;
2126
2142
  export function tsEnumDeclaration(id: Identifier, members: Array<TSEnumMember>): TSEnumDeclaration;
2127
2143
  export function tsEnumMember(id: Identifier | StringLiteral, initializer?: Expression | null): TSEnumMember;
2128
2144
  export function tsModuleDeclaration(id: Identifier | StringLiteral, body: TSModuleBlock | TSModuleDeclaration): TSModuleDeclaration;
@@ -2618,6 +2634,8 @@ export function isTSDeclareMethod(node: object | null | undefined, opts?: object
2618
2634
  export function assertTSDeclareMethod(node: object | null | undefined, opts?: object | null): void;
2619
2635
  export function isTSEntityName(node: object | null | undefined, opts?: object | null): node is TSEntityName;
2620
2636
  export function assertTSEntityName(node: object | null | undefined, opts?: object | null): void;
2637
+ export function isTSEnumBody(node: object | null | undefined, opts?: object | null): node is TSEnumBody;
2638
+ export function assertTSEnumBody(node: object | null | undefined, opts?: object | null): void;
2621
2639
  export function isTSEnumDeclaration(node: object | null | undefined, opts?: object | null): node is TSEnumDeclaration;
2622
2640
  export function assertTSEnumDeclaration(node: object | null | undefined, opts?: object | null): void;
2623
2641
  export function isTSEnumMember(node: object | null | undefined, opts?: object | null): node is TSEnumMember;
@@ -2692,6 +2710,8 @@ export function isTSStringKeyword(node: object | null | undefined, opts?: object
2692
2710
  export function assertTSStringKeyword(node: object | null | undefined, opts?: object | null): void;
2693
2711
  export function isTSSymbolKeyword(node: object | null | undefined, opts?: object | null): node is TSSymbolKeyword;
2694
2712
  export function assertTSSymbolKeyword(node: object | null | undefined, opts?: object | null): void;
2713
+ export function isTSTemplateLiteralType(node: object | null | undefined, opts?: object | null): node is TSTemplateLiteralType;
2714
+ export function assertTSTemplateLiteralType(node: object | null | undefined, opts?: object | null): void;
2695
2715
  export function isTSThisType(node: object | null | undefined, opts?: object | null): node is TSThisType;
2696
2716
  export function assertTSThisType(node: object | null | undefined, opts?: object | null): void;
2697
2717
  export function isTSTupleType(node: object | null | undefined, opts?: object | null): node is TSTupleType;
package/index.d.ts CHANGED
@@ -69,6 +69,9 @@ export function getRuntimeEntryFiles(
69
69
  translator?: string | undefined,
70
70
  ): string[];
71
71
 
72
+ export function getFile(): types.BabelFile;
73
+ export function getProgram(): types.NodePath<types.Program>;
74
+
72
75
  export namespace taglib {
73
76
  export function resolveOptionalTaglibs(
74
77
  taglibIds: string[],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/compiler",
3
- "version": "5.39.13",
3
+ "version": "5.39.15",
4
4
  "description": "Marko template to JS compiler.",
5
5
  "keywords": [
6
6
  "babel",
@@ -63,19 +63,19 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@babel/code-frame": "^7.26.2",
66
- "@babel/core": "^7.26.0",
67
- "@babel/generator": "^7.26.3",
68
- "@babel/parser": "^7.26.3",
66
+ "@babel/core": "^7.26.10",
67
+ "@babel/generator": "^7.27.0",
68
+ "@babel/parser": "^7.27.0",
69
69
  "@babel/plugin-syntax-typescript": "^7.25.9",
70
70
  "@babel/plugin-transform-modules-commonjs": "^7.26.3",
71
- "@babel/plugin-transform-typescript": "^7.26.3",
72
- "@babel/runtime": "^7.26.0",
73
- "@babel/traverse": "^7.26.4",
74
- "@babel/types": "^7.26.3",
75
- "@luxass/strip-json-comments": "^1.3.2",
71
+ "@babel/plugin-transform-typescript": "^7.27.0",
72
+ "@babel/runtime": "^7.27.0",
73
+ "@babel/traverse": "^7.27.0",
74
+ "@babel/types": "^7.27.0",
75
+ "@luxass/strip-json-comments": "^1.4.0",
76
76
  "complain": "^1.6.1",
77
77
  "he": "^1.2.0",
78
- "htmljs-parser": "^5.5.3",
78
+ "htmljs-parser": "^5.5.4",
79
79
  "jsesc": "^3.1.0",
80
80
  "kleur": "^4.1.5",
81
81
  "lasso-package-root": "^1.0.1",
@@ -87,7 +87,7 @@
87
87
  "source-map-support": "^0.5.21"
88
88
  },
89
89
  "devDependencies": {
90
- "marko": "^5.37.20"
90
+ "marko": "^5.37.24"
91
91
  },
92
92
  "engines": {
93
93
  "node": "18 || 20 || >=22"