@marko/compiler 5.28.4 → 5.29.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.
@@ -10,7 +10,9 @@ var _transform = require("./plugins/transform");
10
10
  var _file = require("./file");
11
11
  var _config = _interopRequireDefault(require("../taglib/config"));
12
12
  var _tryLoadTranslator = _interopRequireDefault(require("../util/try-load-translator"));
13
- var _shouldOptimize = _interopRequireDefault(require("../util/should-optimize"));function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function (nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
13
+ var _shouldOptimize = _interopRequireDefault(require("../util/should-optimize"));
14
+ var _buildCodeFrame = require("../util/build-code-frame");
15
+ var _mergeErrors = _interopRequireDefault(require("../util/merge-errors"));function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function (nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
14
16
 
15
17
  const SOURCE_FILES = new WeakMap();var _default =
16
18
 
@@ -53,11 +55,12 @@ const SOURCE_FILES = new WeakMap();var _default =
53
55
  opts.parserOpts.allowReturnOutsideFunction =
54
56
  opts.parserOpts.allowSuperOutsideMethod =
55
57
  opts.parserOpts.allowUndeclaredExports =
58
+ opts.parserOpts.allowNewTargetOutsideFunction =
56
59
  true;
57
60
  curOpts = opts;
58
61
  },
59
62
  parserOverride(code) {
60
- let prevFS = _config.default.fs;
63
+ const prevFS = _config.default.fs;
61
64
  _config.default.fs = markoOpts.fileSystem;
62
65
  try {
63
66
  const file = getMarkoFile(code, curOpts, markoOpts);
@@ -69,7 +72,9 @@ const SOURCE_FILES = new WeakMap();var _default =
69
72
  }
70
73
  },
71
74
  pre(file) {
72
- let prevFS = _config.default.fs;
75
+ const { buildError: prevBuildError } = file.hub;
76
+ const { buildCodeFrameError: prevCodeFrameError } = file;
77
+ const prevFS = _config.default.fs;
73
78
  _config.default.fs = markoOpts.fileSystem;
74
79
  curOpts = undefined;
75
80
  try {
@@ -84,8 +89,6 @@ const SOURCE_FILES = new WeakMap();var _default =
84
89
 
85
90
  const taglibLookup = sourceFile.___taglibLookup;
86
91
  const rootTranslators = [];
87
- const { buildCodeFrameError } = file;
88
- const { buildError } = file.hub;
89
92
  file.buildCodeFrameError = _file.MarkoFile.prototype.buildCodeFrameError;
90
93
  file.hub.buildError = file.buildCodeFrameError.bind(file);
91
94
  file.markoOpts = markoOpts;
@@ -105,17 +108,17 @@ const SOURCE_FILES = new WeakMap();var _default =
105
108
  rootTranslators.push(translator.translate);
106
109
  file.___compileStage = "translate";
107
110
  traverseAll(file, rootTranslators);
108
- file.buildCodeFrameError = buildCodeFrameError;
109
- file.hub.buildError = buildError;
110
- file.markoOpts =
111
- file.___taglibLookup =
112
- file.___getMarkoFile =
113
- undefined;
114
111
 
115
112
  finalizeMeta(metadata.marko);
116
113
  file.path.scope.crawl(); // Ensure all scopes are accurate for subsequent babel plugins
117
114
  } finally {
118
115
  _config.default.fs = prevFS;
116
+ file.buildCodeFrameError = prevCodeFrameError;
117
+ file.hub.buildError = prevBuildError;
118
+ file.markoOpts =
119
+ file.___taglibLookup =
120
+ file.___getMarkoFile =
121
+ undefined;
119
122
  }
120
123
  },
121
124
  visitor:
@@ -233,6 +236,35 @@ function getMarkoFile(code, fileOpts, markoOpts) {
233
236
  file.___compileStage = "migrate";
234
237
  traverseAll(file, rootMigrators);
235
238
 
239
+ if (file.___hasParseErrors) {
240
+ if (markoOpts.errorRecovery) {
241
+ t.traverseFast(file.path.node, (node) => {
242
+ if (node.type === "MarkoParseError") {
243
+ (0, _babelUtils.diagnosticError)(file.path, {
244
+ label: node.label,
245
+ loc: node.errorLoc || node.loc
246
+ });
247
+ }
248
+ });
249
+ } else {
250
+ let errors = [];
251
+ t.traverseFast(file.path.node, (node) => {
252
+ if (node.type === "MarkoParseError") {
253
+ errors.push(
254
+ (0, _buildCodeFrame.buildCodeFrameError)(
255
+ file.opts.filename,
256
+ file.code,
257
+ node.errorLoc || node.loc,
258
+ node.label));
259
+
260
+
261
+ }
262
+ });
263
+
264
+ (0, _mergeErrors.default)(errors);
265
+ }
266
+ }
267
+
236
268
  if (isMigrate) {
237
269
  return file;
238
270
  }
@@ -6,6 +6,10 @@ var _babelUtils = require("@marko/babel-utils");function _getRequireWildcardCach
6
6
 
7
7
 
8
8
 
9
+
10
+
11
+
12
+
9
13
  const noop = () => {};
10
14
  const emptyRange = (part) => part.start === part.end;
11
15
  const isAttrTag = (tag) => {var _tag$name$value;return ((_tag$name$value = tag.name.value) == null ? void 0 : _tag$name$value[0]) === "@";};
@@ -65,7 +69,12 @@ function parseMarko(file) {
65
69
  case 1:{
66
70
  if (emptyRange(quasis[0]) && emptyRange(quasis[1])) {
67
71
  const [{ value }] = expressions;
68
- const result = (0, _babelUtils.parseExpression)(file, parser.read(value), value.start);
72
+ const result = (0, _babelUtils.parseExpression)(
73
+ file,
74
+ parser.read(value),
75
+ value.start,
76
+ value.end);
77
+
69
78
  if (t.isStringLiteral(result)) {
70
79
  // convert to template literal just so that we don't mistake it for a native tag if this is a tag name.
71
80
  return t.templateLiteral(
@@ -86,11 +95,7 @@ function parseMarko(file) {
86
95
 
87
96
  const [{ start }] = quasis;
88
97
  const end = quasis[quasis.length - 1].end;
89
- return (0, _babelUtils.parseExpression)(
90
- file,
91
- `\`${parser.read({ start, end })}\``,
92
- start - 1);
93
-
98
+ return (0, _babelUtils.parseTemplateLiteral)(file, parser.read({ start, end }), start, end);
94
99
  };
95
100
 
96
101
  const parser = (0, _htmljsParser.createParser)({
@@ -196,7 +201,12 @@ function parseMarko(file) {
196
201
  pushContent(
197
202
  withLoc(
198
203
  t.markoPlaceholder(
199
- (0, _babelUtils.parseExpression)(file, parser.read(part.value), part.value.start),
204
+ (0, _babelUtils.parseExpression)(
205
+ file,
206
+ parser.read(part.value),
207
+ part.value.start,
208
+ part.value.end),
209
+
200
210
  part.escape),
201
211
 
202
212
  part));
@@ -207,7 +217,12 @@ function parseMarko(file) {
207
217
  pushContent(
208
218
  withLoc(
209
219
  t.markoScriptlet(
210
- (0, _babelUtils.parseScript)(file, parser.read(part.value), part.value.start).body),
220
+ (0, _babelUtils.parseStatements)(
221
+ file,
222
+ parser.read(part.value),
223
+ part.value.start,
224
+ part.value.end)),
225
+
211
226
 
212
227
  part));
213
228
 
@@ -264,28 +279,31 @@ function parseMarko(file) {
264
279
  }
265
280
  },
266
281
 
267
- onTagVar(part) {
268
- currentTag.node.var = (0, _babelUtils.parseExpression)(
282
+ onTagVar({ value }) {
283
+ currentTag.node.var = (0, _babelUtils.parseVar)(
269
284
  file,
270
- `(${parser.read(part.value)})=>{}`,
271
- part.value.start - 1).
272
- params[0];
285
+ parser.read(value),
286
+ value.start,
287
+ value.end);
288
+
273
289
  },
274
290
 
275
- onTagParams(part) {
276
- currentTag.node.body.params = (0, _babelUtils.parseExpression)(
291
+ onTagParams({ value }) {
292
+ currentTag.node.body.params = (0, _babelUtils.parseParams)(
277
293
  file,
278
- `(${parser.read(part.value)})=>{}`,
279
- part.start).
280
- params;
294
+ parser.read(value),
295
+ value.start,
296
+ value.end);
297
+
281
298
  },
282
299
 
283
- onTagArgs(part) {
284
- currentTag.node.arguments = (0, _babelUtils.parseExpression)(
300
+ onTagArgs({ value }) {
301
+ currentTag.node.arguments = (0, _babelUtils.parseArgs)(
285
302
  file,
286
- `_${parser.read(part)}`,
287
- part.start - 1).
288
- arguments;
303
+ parser.read(value),
304
+ value.start,
305
+ value.end);
306
+
289
307
  },
290
308
 
291
309
  onAttrName(part) {
@@ -305,13 +323,15 @@ function parseMarko(file) {
305
323
  currentAttr.end = part.end;
306
324
  },
307
325
 
308
- onAttrArgs(part) {
309
- currentAttr.arguments = (0, _babelUtils.parseExpression)(
326
+ onAttrArgs({ value, end }) {
327
+ currentAttr.arguments = (0, _babelUtils.parseArgs)(
310
328
  file,
311
- `_${parser.read(part)}`,
312
- part.start - 1).
313
- arguments;
314
- currentAttr.end = part.end;
329
+ parser.read(value),
330
+ value.start,
331
+ value.end);
332
+
333
+
334
+ currentAttr.end = end;
315
335
  },
316
336
 
317
337
  onAttrValue(part) {
@@ -329,16 +349,20 @@ function parseMarko(file) {
329
349
  currentAttr.value = withLoc(
330
350
  t.functionExpression(
331
351
  undefined,
332
- (0, _babelUtils.parseExpression)(
352
+ (0, _babelUtils.parseParams)(
333
353
  file,
334
- `${parser.read(part.params)}=>{}`,
335
- part.params.start).
336
- params,
337
- (0, _babelUtils.parseExpression)(
354
+ parser.read(part.params.value),
355
+ part.params.value.start,
356
+ part.params.value.end),
357
+
358
+ t.blockStatement(
359
+ (0, _babelUtils.parseStatements)(
338
360
  file,
339
- `()=>${parser.read(part.body)}`,
340
- part.body.start - 4).
341
- body),
361
+ parser.read(part.body.value),
362
+ part.body.value.start,
363
+ part.body.value.end))),
364
+
365
+
342
366
 
343
367
  part);
344
368
 
@@ -15,6 +15,9 @@ const UNENCLOSED_WHITESPACE_TYPES = [
15
15
 
16
16
 
17
17
  Object.assign(_printer.default.prototype, {
18
+ MarkoParseError(node) {
19
+ this.token(node.source);
20
+ },
18
21
  MarkoDocumentType(node) {
19
22
  this.token("<!");
20
23
  this.token(node.value);
@@ -13,6 +13,22 @@ const valueFieldCommon = {
13
13
  };
14
14
 
15
15
  const MarkoDefinitions = {
16
+ MarkoParseError: {
17
+ aliases: ["Marko", "Expression", "Statement"],
18
+ builder: ["source", "label", "errorLoc"],
19
+ fields: {
20
+ source: {
21
+ validate: (0, _utils.assertValueType)("string")
22
+ },
23
+ label: {
24
+ validate: (0, _utils.assertValueType)("string")
25
+ },
26
+ errorLoc: {
27
+ optional: true,
28
+ validate: (0, _utils.assertValueType)("object")
29
+ }
30
+ }
31
+ },
16
32
  MarkoDocumentType: {
17
33
  aliases: ["Marko", "Statement"],
18
34
  builder: ["value"],
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
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 = void 0;var _types = _interopRequireWildcard(require("./babel-types"));exports.types = _types;
2
2
  var _path = _interopRequireDefault(require("path"));
3
- var _kleur = _interopRequireDefault(require("kleur"));
4
3
  var babel = _interopRequireWildcard(require("@babel/core"));
5
4
  var _pluginTransformModulesCommonjs = _interopRequireDefault(require("@babel/plugin-transform-modules-commonjs"));
6
5
  var _pluginSyntaxTypescript = _interopRequireDefault(require("@babel/plugin-syntax-typescript"));
@@ -11,7 +10,8 @@ var _config = _interopRequireDefault(require("./config"));
11
10
  var taglib = _interopRequireWildcard(require("./taglib"));exports.taglib = taglib;
12
11
  var _shouldOptimize = _interopRequireDefault(require("./util/should-optimize"));
13
12
  var _tryLoadTranslator = _interopRequireDefault(require("./util/try-load-translator"));
14
- var _buildCodeFrame = require("./util/build-code-frame");function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function (nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
13
+ var _buildCodeFrame = require("./util/build-code-frame");
14
+ var _mergeErrors = _interopRequireDefault(require("./util/merge-errors"));function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function (nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
15
15
 
16
16
 
17
17
  let globalConfig = { ..._config.default };
@@ -65,14 +65,14 @@ function loadMarkoConfig(config) {
65
65
  const markoConfig = { ...globalConfig, ...config };
66
66
 
67
67
  if (markoConfig.stripTypes === undefined) {
68
- markoConfig.stripTypes =
69
- markoConfig.output !== "source" && markoConfig.output !== "migrate";
68
+ markoConfig.stripTypes = isTranslatedOutput(markoConfig.output);
70
69
  }
71
70
 
72
71
  return markoConfig;
73
72
  }
74
73
 
75
74
  function loadBabelConfig(filename, { babelConfig, ...markoConfig }) {
75
+ const isTranslated = isTranslatedOutput(markoConfig.output);
76
76
  const requiredPlugins = [
77
77
  [_babelPlugin.default, markoConfig],
78
78
  [
@@ -92,23 +92,29 @@ function loadBabelConfig(filename, { babelConfig, ...markoConfig }) {
92
92
  _path.default.relative(process.cwd(), filename) :
93
93
  undefined,
94
94
  sourceFileName: filename ? _path.default.basename(filename) : undefined,
95
+ configFile: isTranslated,
96
+ babelrc: isTranslated,
95
97
  ...babelConfig,
96
98
  filename,
97
99
  sourceType: "module",
98
100
  sourceMaps: markoConfig.sourceMaps,
99
101
  code: markoConfig.code,
100
- ast: markoConfig.ast
102
+ ast: markoConfig.ast,
103
+ plugins:
104
+ babelConfig && babelConfig.plugins ?
105
+ requiredPlugins.concat(babelConfig.plugins) :
106
+ requiredPlugins
101
107
  };
102
108
 
103
- if (markoConfig.modules === "cjs") {
104
- requiredPlugins.push([_pluginTransformModulesCommonjs.default, { loose: true }]);
105
- }
106
-
107
- baseBabelConfig.plugins = requiredPlugins.concat(
108
- baseBabelConfig.plugins || []);
109
+ if (isTranslated) {
110
+ if (markoConfig.modules === "cjs") {
111
+ baseBabelConfig.plugins.push([_pluginTransformModulesCommonjs.default, { loose: true }]);
112
+ }
109
113
 
114
+ return babel.loadPartialConfig(baseBabelConfig).options;
115
+ }
110
116
 
111
- return babel.loadPartialConfig(baseBabelConfig).options;
117
+ return baseBabelConfig;
112
118
  }
113
119
 
114
120
  function buildResult(src, filename, errorRecovery, babelResult) {
@@ -128,32 +134,7 @@ function buildResult(src, filename, errorRecovery, babelResult) {
128
134
  }
129
135
  }
130
136
 
131
- switch (errors.length) {
132
- case 0:
133
- break;
134
- case 1:{
135
- throw errors[0];
136
- }
137
- default:{
138
- let err;
139
- const message = `${_kleur.default.red("AggregationError:")}\n${errors.
140
- map((err) => err.message).
141
- join("\n\n").
142
- replace(/^(?!\s*$)/gm, "\t")}\n`;
143
-
144
- if (typeof AggregateError === "function") {
145
- err = new AggregateError(errors, message);
146
- } else {
147
- err = new Error(message);
148
- err.name = "AggregateError";
149
- err.errors = errors;
150
- }
151
-
152
- // Remove the stack trace from the error since it is not useful.
153
- err.stack = "";
154
- throw err;
155
- }}
156
-
137
+ (0, _mergeErrors.default)(errors);
157
138
  }
158
139
 
159
140
  return { ast, map, code, meta };
@@ -180,4 +161,8 @@ function isDefaultCache(config) {
180
161
 
181
162
  function getFs(config) {
182
163
  return config.fileSystem || globalConfig.fileSystem;
164
+ }
165
+
166
+ function isTranslatedOutput(output) {
167
+ return output !== "source" && output !== "migrate";
183
168
  }
@@ -592,6 +592,7 @@ export class NodePath<T = Node> {
592
592
  //#endregion
593
593
 
594
594
  //#region ------------------------- isXXX -------------------------
595
+ isMarkoParseError(props?: object | null): this is NodePath<t.MarkoParseError>;
595
596
  isMarkoDocumentType(props?: object | null): this is NodePath<t.MarkoDocumentType>;
596
597
  isMarkoDeclaration(props?: object | null): this is NodePath<t.MarkoDeclaration>;
597
598
  isMarkoCDATA(props?: object | null): this is NodePath<t.MarkoCDATA>;
@@ -895,6 +896,7 @@ export class NodePath<T = Node> {
895
896
  //#endregion
896
897
 
897
898
  //#region ------------------------- assertXXX -------------------------
899
+ assertMarkoParseError(props?: object | null): void;
898
900
  assertMarkoDocumentType(props?: object | null): void;
899
901
  assertMarkoDeclaration(props?: object | null): void;
900
902
  assertMarkoCDATA(props?: object | null): void;
package/dist/types.d.ts CHANGED
@@ -42,7 +42,7 @@ interface BaseNode {
42
42
  extra?: Record<string, unknown>;
43
43
  }
44
44
 
45
- 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 | ImportNamespaceSpecifier | 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 | 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;
45
+ 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 | ImportNamespaceSpecifier | 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;
46
46
 
47
47
  export interface ArrayExpression extends BaseNode {
48
48
  type: "ArrayExpression";
@@ -1650,6 +1650,13 @@ export interface TSTypeParameter extends BaseNode {
1650
1650
  out: boolean | null;
1651
1651
  }
1652
1652
 
1653
+ export interface MarkoParseError extends BaseNode {
1654
+ type: "MarkoParseError";
1655
+ source: string;
1656
+ label: string;
1657
+ errorLoc: object | null;
1658
+ }
1659
+
1653
1660
  export interface MarkoDocumentType extends BaseNode {
1654
1661
  type: "MarkoDocumentType";
1655
1662
  value: string;
@@ -1744,12 +1751,12 @@ export type RestProperty = RestElement;
1744
1751
  export type SpreadProperty = SpreadElement;
1745
1752
 
1746
1753
  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 | MetaProperty | ClassMethod | ObjectPattern | SpreadElement | Super | TaggedTemplateExpression | TemplateElement | TemplateLiteral | YieldExpression | AwaitExpression | Import | BigIntLiteral | ExportNamespaceSpecifier | OptionalMemberExpression | OptionalCallExpression | ClassProperty | ClassAccessorProperty | ClassPrivateProperty | ClassPrivateMethod | PrivateName | StaticBlock;
1747
- 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 | 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;
1754
+ 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 | 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;
1748
1755
  export type Binary = BinaryExpression | LogicalExpression;
1749
1756
  export type Scopable = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ClassExpression | ClassDeclaration | ForOfStatement | ClassMethod | ClassPrivateMethod | StaticBlock | TSModuleBlock;
1750
1757
  export type BlockParent = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ForOfStatement | ClassMethod | ClassPrivateMethod | StaticBlock | TSModuleBlock | MarkoTagBody;
1751
1758
  export type Block = BlockStatement | Program | TSModuleBlock;
1752
- export type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | ForInStatement | ForStatement | FunctionDeclaration | IfStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | VariableDeclaration | WhileStatement | WithStatement | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ForOfStatement | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | InterfaceDeclaration | OpaqueType | TypeAlias | EnumDeclaration | TSDeclareFunction | TSInterfaceDeclaration | TSTypeAliasDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSImportEqualsDeclaration | TSExportAssignment | TSNamespaceExportDeclaration | MarkoDocumentType | MarkoDeclaration | MarkoCDATA | MarkoComment | MarkoText | MarkoPlaceholder | MarkoScriptlet | MarkoClass | MarkoTag;
1759
+ export type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | ForInStatement | ForStatement | FunctionDeclaration | IfStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | VariableDeclaration | WhileStatement | WithStatement | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ForOfStatement | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | InterfaceDeclaration | OpaqueType | TypeAlias | EnumDeclaration | TSDeclareFunction | TSInterfaceDeclaration | TSTypeAliasDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSImportEqualsDeclaration | TSExportAssignment | TSNamespaceExportDeclaration | MarkoParseError | MarkoDocumentType | MarkoDeclaration | MarkoCDATA | MarkoComment | MarkoText | MarkoPlaceholder | MarkoScriptlet | MarkoClass | MarkoTag;
1753
1760
  export type Terminatorless = BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement | YieldExpression | AwaitExpression;
1754
1761
  export type CompletionStatement = BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement;
1755
1762
  export type Conditional = ConditionalExpression | IfStatement;
@@ -1792,7 +1799,7 @@ export type TypeScript = TSParameterProperty | TSDeclareFunction | TSDeclareMeth
1792
1799
  export type TSTypeElement = TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSPropertySignature | TSMethodSignature | TSIndexSignature;
1793
1800
  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;
1794
1801
  export type TSBaseType = TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSLiteralType;
1795
- export type Marko = MarkoDocumentType | MarkoDeclaration | MarkoCDATA | MarkoComment | MarkoText | MarkoPlaceholder | MarkoScriptlet | MarkoClass | MarkoAttribute | MarkoSpreadAttribute | MarkoTagBody | MarkoTag;
1802
+ export type Marko = MarkoParseError | MarkoDocumentType | MarkoDeclaration | MarkoCDATA | MarkoComment | MarkoText | MarkoPlaceholder | MarkoScriptlet | MarkoClass | MarkoAttribute | MarkoSpreadAttribute | MarkoTagBody | MarkoTag;
1796
1803
  export type Scope = MarkoTagBody;
1797
1804
 
1798
1805
  export interface Aliases {
@@ -2100,6 +2107,7 @@ export function tsTypeAnnotation(typeAnnotation: TSType): TSTypeAnnotation;
2100
2107
  export function tsTypeParameterInstantiation(params: Array<TSType>): TSTypeParameterInstantiation;
2101
2108
  export function tsTypeParameterDeclaration(params: Array<TSTypeParameter>): TSTypeParameterDeclaration;
2102
2109
  export function tsTypeParameter(constraint: TSType | null | undefined, _default: TSType | null | undefined, name: string): TSTypeParameter;
2110
+ export function markoParseError(source: string, label: string, errorLoc?: object | null): MarkoParseError;
2103
2111
  export function markoDocumentType(value: string): MarkoDocumentType;
2104
2112
  export function markoDeclaration(value: string): MarkoDeclaration;
2105
2113
  export function markoCDATA(value: string): MarkoCDATA;
@@ -2396,6 +2404,8 @@ export function isMarkoDeclaration(node: object | null | undefined, opts?: objec
2396
2404
  export function assertMarkoDeclaration(node: object | null | undefined, opts?: object | null): void;
2397
2405
  export function isMarkoDocumentType(node: object | null | undefined, opts?: object | null): node is MarkoDocumentType;
2398
2406
  export function assertMarkoDocumentType(node: object | null | undefined, opts?: object | null): void;
2407
+ export function isMarkoParseError(node: object | null | undefined, opts?: object | null): node is MarkoParseError;
2408
+ export function assertMarkoParseError(node: object | null | undefined, opts?: object | null): void;
2399
2409
  export function isMarkoPlaceholder(node: object | null | undefined, opts?: object | null): node is MarkoPlaceholder;
2400
2410
  export function assertMarkoPlaceholder(node: object | null | undefined, opts?: object | null): void;
2401
2411
  export function isMarkoScriptlet(node: object | null | undefined, opts?: object | null): node is MarkoScriptlet;
@@ -0,0 +1,28 @@
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = throwAggregateError;var _kleur = _interopRequireDefault(require("kleur"));
2
+
3
+ function throwAggregateError(errors) {
4
+ switch (errors.length) {
5
+ case 0:
6
+ return;
7
+ case 1:
8
+ throw errors[0];}
9
+
10
+
11
+ let err;
12
+ const message = `${_kleur.default.red("AggregationError:")}\n${errors.
13
+ map((err) => err.message).
14
+ join("\n\n").
15
+ replace(/^(?!\s*$)/gm, "\t")}\n`;
16
+
17
+ if (typeof AggregateError === "function") {
18
+ err = new AggregateError(errors, message);
19
+ } else {
20
+ err = new Error(message);
21
+ err.name = "AggregateError";
22
+ err.errors = errors;
23
+ }
24
+
25
+ // Remove the stack trace from the error since it is not useful.
26
+ err.stack = "";
27
+ throw err;
28
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marko/compiler",
3
3
  "description": "Marko template to JS compiler.",
4
- "version": "5.28.4",
4
+ "version": "5.29.0",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
7
7
  "dependencies": {
@@ -15,7 +15,7 @@
15
15
  "@babel/runtime": "^7.16.0",
16
16
  "@babel/traverse": "^7.16.0",
17
17
  "@babel/types": "^7.16.0",
18
- "@marko/babel-utils": "^5.22.1",
18
+ "@marko/babel-utils": "^6.0.0",
19
19
  "complain": "^1.6.0",
20
20
  "he": "^1.2.0",
21
21
  "htmljs-parser": "^5.4.3",
@@ -30,7 +30,7 @@
30
30
  "strip-json-comments": "^3.1.1"
31
31
  },
32
32
  "devDependencies": {
33
- "@marko/translator-default": "^5.26.4"
33
+ "@marko/translator-default": "^5.27.0"
34
34
  },
35
35
  "files": [
36
36
  "dist",