@marko/compiler 5.33.0 → 5.33.2
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.
- package/dist/babel-plugin/index.js +21 -21
- package/dist/babel-plugin/parser.js +125 -125
- package/dist/babel-types/traverse/patch.js +32 -32
- package/dist/babel-types/types/definitions.js +15 -13
- package/dist/babel-types/types/patch.js +8 -8
- package/dist/register.js +12 -12
- package/dist/taglib/finder/index.js +3 -3
- package/dist/taglib/index.js +9 -9
- package/dist/taglib/loader/Taglib.js +2 -2
- package/dist/taglib/loader/index.js +4 -4
- package/dist/taglib/loader/json-file-reader.js +2 -2
- package/dist/taglib/loader/loadAttributeFromProps.js +8 -8
- package/dist/taglib/loader/loadAttributes.js +4 -4
- package/dist/taglib/loader/loadTagFromProps.js +60 -45
- package/dist/taglib/loader/loadTaglibFromDir.js +6 -6
- package/dist/taglib/loader/loadTaglibFromProps.js +45 -45
- package/dist/taglib/loader/property-handlers.js +5 -5
- package/dist/taglib/loader/scanTagsDir.js +5 -5
- package/dist/traverse.d.ts +940 -658
- package/dist/util/build-code-frame.js +18 -18
- package/dist/util/merge-errors.js +2 -2
- package/package.json +2 -2
|
@@ -19,8 +19,8 @@ const SOURCE_FILES = new WeakMap();var _default =
|
|
|
19
19
|
(api, markoOpts) => {
|
|
20
20
|
api.assertVersion(7);
|
|
21
21
|
const translator = markoOpts.translator = (0, _tryLoadTranslator.default)(
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
markoOpts.translator
|
|
23
|
+
);
|
|
24
24
|
markoOpts.output = markoOpts.output || "html";
|
|
25
25
|
|
|
26
26
|
if (markoOpts.optimize === undefined) {
|
|
@@ -30,8 +30,8 @@ const SOURCE_FILES = new WeakMap();var _default =
|
|
|
30
30
|
|
|
31
31
|
if (!translator || !translator.translate) {
|
|
32
32
|
throw new Error(
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
"@marko/compiler: translator must provide a translate visitor object"
|
|
34
|
+
);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
if (
|
|
@@ -39,8 +39,8 @@ const SOURCE_FILES = new WeakMap();var _default =
|
|
|
39
39
|
typeof markoOpts.resolveVirtualDependency !== "function")
|
|
40
40
|
{
|
|
41
41
|
throw new Error(
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
`@marko/compiler: the "resolveVirtualDependency" option must be supplied when output is "hydrate".`
|
|
43
|
+
);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
let curOpts;
|
|
@@ -98,10 +98,10 @@ const SOURCE_FILES = new WeakMap();var _default =
|
|
|
98
98
|
if (markoOpts.output !== "hydrate") {
|
|
99
99
|
for (const id in taglibLookup.taglibsById) {
|
|
100
100
|
addPlugin(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
metadata.marko,
|
|
102
|
+
rootTranslators,
|
|
103
|
+
taglibLookup.taglibsById[id].translator
|
|
104
|
+
);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -127,8 +127,8 @@ const SOURCE_FILES = new WeakMap();var _default =
|
|
|
127
127
|
MarkoClass(path) {
|
|
128
128
|
// We replace the MarkoClass with a regular class declaration so babel can strip it's types.
|
|
129
129
|
path.replaceWith(
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
t.classDeclaration(t.identifier(""), null, path.node.body)
|
|
131
|
+
);
|
|
132
132
|
},
|
|
133
133
|
ExportNamedDeclaration: {
|
|
134
134
|
exit(path) {
|
|
@@ -250,13 +250,13 @@ function getMarkoFile(code, fileOpts, markoOpts) {
|
|
|
250
250
|
t.traverseFast(file.path.node, (node) => {
|
|
251
251
|
if (node.type === "MarkoParseError") {
|
|
252
252
|
errors.push(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
253
|
+
(0, _buildCodeFrame.buildCodeFrameError)(
|
|
254
|
+
file.opts.filename,
|
|
255
|
+
file.code,
|
|
256
|
+
node.errorLoc || node.loc,
|
|
257
|
+
node.label
|
|
258
|
+
)
|
|
259
|
+
);
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
262
|
|
|
@@ -337,8 +337,8 @@ function shallowClone(data) {
|
|
|
337
337
|
break;
|
|
338
338
|
|
|
339
339
|
default:
|
|
340
|
-
throw new Error(`Unsupported metadata type of ${Ctor.name}`);
|
|
341
|
-
|
|
340
|
+
throw new Error(`Unsupported metadata type of ${Ctor.name}`);
|
|
341
|
+
}
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
@@ -70,28 +70,28 @@ function parseMarko(file) {
|
|
|
70
70
|
if (emptyRange(quasis[0]) && emptyRange(quasis[1])) {
|
|
71
71
|
const [{ value }] = expressions;
|
|
72
72
|
const result = (0, _babelUtils.parseExpression)(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
file,
|
|
74
|
+
parser.read(value),
|
|
75
|
+
value.start,
|
|
76
|
+
value.end
|
|
77
|
+
);
|
|
78
78
|
if (t.isStringLiteral(result)) {
|
|
79
79
|
// convert to template literal just so that we don't mistake it for a native tag if this is a tag name.
|
|
80
80
|
return t.templateLiteral(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
[
|
|
82
|
+
t.templateElement({
|
|
83
|
+
raw: result.value,
|
|
84
|
+
cooked: result.value
|
|
85
|
+
})],
|
|
86
|
+
|
|
87
|
+
[]
|
|
88
|
+
);
|
|
89
89
|
} else {
|
|
90
90
|
return result;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
}
|
|
94
|
-
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
95
|
|
|
96
96
|
const [{ start }] = quasis;
|
|
97
97
|
const end = quasis[quasis.length - 1].end;
|
|
@@ -142,8 +142,8 @@ function parseMarko(file) {
|
|
|
142
142
|
break;
|
|
143
143
|
default:
|
|
144
144
|
value = value.replace(/^[\n\r]\s*/, "");
|
|
145
|
-
break;
|
|
146
|
-
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
147
|
|
|
148
148
|
const node = t.markoText(value);
|
|
149
149
|
pushContent(node);
|
|
@@ -167,8 +167,8 @@ function parseMarko(file) {
|
|
|
167
167
|
break;
|
|
168
168
|
default:
|
|
169
169
|
value = value.replace(/[\n\r]\s*$/, "");
|
|
170
|
-
break;
|
|
171
|
-
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
172
|
|
|
173
173
|
node.value = value.replace(/\s+/g, " ");
|
|
174
174
|
|
|
@@ -199,34 +199,34 @@ function parseMarko(file) {
|
|
|
199
199
|
},
|
|
200
200
|
onPlaceholder(part) {
|
|
201
201
|
pushContent(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
202
|
+
withLoc(
|
|
203
|
+
t.markoPlaceholder(
|
|
204
|
+
(0, _babelUtils.parseExpression)(
|
|
205
|
+
file,
|
|
206
|
+
parser.read(part.value),
|
|
207
|
+
part.value.start,
|
|
208
|
+
part.value.end
|
|
209
|
+
),
|
|
210
|
+
part.escape
|
|
211
|
+
),
|
|
212
|
+
part
|
|
213
|
+
)
|
|
214
|
+
);
|
|
215
215
|
},
|
|
216
216
|
onScriptlet(part) {
|
|
217
217
|
pushContent(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
218
|
+
withLoc(
|
|
219
|
+
t.markoScriptlet(
|
|
220
|
+
(0, _babelUtils.parseStatements)(
|
|
221
|
+
file,
|
|
222
|
+
parser.read(part.value),
|
|
223
|
+
part.value.start,
|
|
224
|
+
part.value.end
|
|
225
|
+
)
|
|
226
|
+
),
|
|
227
|
+
part
|
|
228
|
+
)
|
|
229
|
+
);
|
|
230
230
|
},
|
|
231
231
|
onOpenTagName(part) {
|
|
232
232
|
const tagName = parseTemplateString(part);
|
|
@@ -240,15 +240,15 @@ function parseMarko(file) {
|
|
|
240
240
|
|
|
241
241
|
if (literalTagName === "%") {
|
|
242
242
|
throw file.buildCodeFrameError(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
tagName,
|
|
244
|
+
"<% scriptlets %> are no longer supported."
|
|
245
|
+
);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
const parseOptions = (_node$tagDef = node.tagDef = (0, _babelUtils.getTagDefForTagName)(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
parseOptions;
|
|
249
|
+
file,
|
|
250
|
+
literalTagName
|
|
251
|
+
)) == null ? void 0 : _node$tagDef.parseOptions;
|
|
252
252
|
|
|
253
253
|
if (parseOptions) {
|
|
254
254
|
if (parseOptions.preserveWhitespace) {
|
|
@@ -281,43 +281,43 @@ function parseMarko(file) {
|
|
|
281
281
|
|
|
282
282
|
onTagVar({ value }) {
|
|
283
283
|
currentTag.node.var = (0, _babelUtils.parseVar)(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
file,
|
|
285
|
+
parser.read(value),
|
|
286
|
+
value.start,
|
|
287
|
+
value.end
|
|
288
|
+
);
|
|
289
289
|
},
|
|
290
290
|
|
|
291
291
|
onTagParams({ value }) {
|
|
292
292
|
currentTag.node.body.params = (0, _babelUtils.parseParams)(
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
293
|
+
file,
|
|
294
|
+
parser.read(value),
|
|
295
|
+
value.start,
|
|
296
|
+
value.end
|
|
297
|
+
);
|
|
298
298
|
},
|
|
299
299
|
|
|
300
300
|
onTagArgs({ value }) {
|
|
301
301
|
currentTag.node.arguments = (0, _babelUtils.parseArgs)(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
302
|
+
file,
|
|
303
|
+
parser.read(value),
|
|
304
|
+
value.start,
|
|
305
|
+
value.end
|
|
306
|
+
);
|
|
307
307
|
},
|
|
308
308
|
|
|
309
309
|
onAttrName(part) {
|
|
310
310
|
const [, name, modifier] = /^([^:]*)(?::(.*))?/.exec(parser.read(part));
|
|
311
311
|
endAttr();
|
|
312
312
|
currentTag.node.attributes.push(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
313
|
+
currentAttr = t.markoAttribute(
|
|
314
|
+
name || "value",
|
|
315
|
+
t.booleanLiteral(true),
|
|
316
|
+
modifier,
|
|
317
|
+
undefined,
|
|
318
|
+
!name
|
|
319
|
+
)
|
|
320
|
+
);
|
|
321
321
|
|
|
322
322
|
currentAttr.start = part.start;
|
|
323
323
|
currentAttr.end = part.end;
|
|
@@ -325,11 +325,11 @@ function parseMarko(file) {
|
|
|
325
325
|
|
|
326
326
|
onAttrArgs({ value, end }) {
|
|
327
327
|
currentAttr.arguments = (0, _babelUtils.parseArgs)(
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
328
|
+
file,
|
|
329
|
+
parser.read(value),
|
|
330
|
+
value.start,
|
|
331
|
+
value.end
|
|
332
|
+
);
|
|
333
333
|
|
|
334
334
|
currentAttr.end = end;
|
|
335
335
|
},
|
|
@@ -338,46 +338,46 @@ function parseMarko(file) {
|
|
|
338
338
|
currentAttr.end = part.end;
|
|
339
339
|
currentAttr.bound = part.bound;
|
|
340
340
|
currentAttr.value = (0, _babelUtils.parseExpression)(
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
341
|
+
file,
|
|
342
|
+
parser.read(part.value),
|
|
343
|
+
part.value.start
|
|
344
|
+
);
|
|
345
345
|
},
|
|
346
346
|
|
|
347
347
|
onAttrMethod(part) {
|
|
348
348
|
currentAttr.end = part.end;
|
|
349
349
|
currentAttr.value = withLoc(
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
350
|
+
t.functionExpression(
|
|
351
|
+
undefined,
|
|
352
|
+
(0, _babelUtils.parseParams)(
|
|
353
|
+
file,
|
|
354
|
+
parser.read(part.params.value),
|
|
355
|
+
part.params.value.start,
|
|
356
|
+
part.params.value.end
|
|
357
|
+
),
|
|
358
|
+
t.blockStatement(
|
|
359
|
+
(0, _babelUtils.parseStatements)(
|
|
360
|
+
file,
|
|
361
|
+
parser.read(part.body.value),
|
|
362
|
+
part.body.value.start,
|
|
363
|
+
part.body.value.end
|
|
364
|
+
)
|
|
365
|
+
)
|
|
366
|
+
),
|
|
367
|
+
part
|
|
368
|
+
);
|
|
369
369
|
},
|
|
370
370
|
|
|
371
371
|
onAttrSpread(part) {
|
|
372
372
|
endAttr();
|
|
373
373
|
currentTag.node.attributes.push(
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
374
|
+
withLoc(
|
|
375
|
+
t.markoSpreadAttribute(
|
|
376
|
+
(0, _babelUtils.parseExpression)(file, parser.read(part.value), part.value.start)
|
|
377
|
+
),
|
|
378
|
+
part
|
|
379
|
+
)
|
|
380
|
+
);
|
|
381
381
|
},
|
|
382
382
|
|
|
383
383
|
onOpenTagEnd(part) {var _node$tagDef2;
|
|
@@ -392,19 +392,19 @@ function parseMarko(file) {
|
|
|
392
392
|
currentShorthandClassNames.length === 1 ?
|
|
393
393
|
currentShorthandClassNames[0] :
|
|
394
394
|
currentShorthandClassNames.every((expr) =>
|
|
395
|
-
t.isStringLiteral(expr)
|
|
396
|
-
|
|
395
|
+
t.isStringLiteral(expr)
|
|
396
|
+
) ?
|
|
397
397
|
withLoc(
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
398
|
+
t.stringLiteral(
|
|
399
|
+
currentShorthandClassNames.map((node) => node.value).join(" ")
|
|
400
|
+
),
|
|
401
|
+
{
|
|
402
|
+
start: currentShorthandClassNames[0].start,
|
|
403
|
+
end: currentShorthandClassNames[
|
|
404
|
+
currentShorthandClassNames.length - 1].
|
|
405
|
+
end
|
|
406
|
+
}
|
|
407
|
+
) :
|
|
408
408
|
t.arrayExpression(currentShorthandClassNames);
|
|
409
409
|
|
|
410
410
|
for (const attr of attributes) {
|
|
@@ -442,14 +442,14 @@ function parseMarko(file) {
|
|
|
442
442
|
for (const attr of attributes) {
|
|
443
443
|
if (attr.name === "id") {
|
|
444
444
|
throw file.buildCodeFrameError(
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
445
|
+
attr,
|
|
446
|
+
"Cannot have shorthand id and id attribute."
|
|
447
|
+
);
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
currentTag.node.attributes.push(
|
|
451
|
-
|
|
452
|
-
|
|
451
|
+
t.markoAttribute("id", currentShorthandId)
|
|
452
|
+
);
|
|
453
453
|
currentShorthandId = undefined;
|
|
454
454
|
}
|
|
455
455
|
|
|
@@ -43,40 +43,40 @@ _traverse.Scope.prototype.crawl = function () {
|
|
|
43
43
|
if (!patchedVisitors.has(visitor)) {
|
|
44
44
|
patchedVisitors.add(visitor);
|
|
45
45
|
Object.assign(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
46
|
+
_traverse.default.explode(visitor),
|
|
47
|
+
_traverse.default.explode({
|
|
48
|
+
MarkoTagBody(body) {
|
|
49
|
+
for (const param of body.get("params")) {
|
|
50
|
+
body.scope.registerBinding("param", param);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
MarkoTag(tag, state) {
|
|
54
|
+
const tagVar = tag.get("var");
|
|
55
|
+
if (tagVar.node) {
|
|
56
|
+
tag.scope.registerBinding("local", tagVar, tag);
|
|
57
|
+
for (const name in tagVar.getBindingIdentifiers()) {
|
|
58
|
+
let curScope = tag.scope;
|
|
59
|
+
const binding = curScope.getBinding(name);
|
|
60
|
+
|
|
61
|
+
while (curScope = curScope.parent) {
|
|
62
|
+
const hoistableTagVars =
|
|
63
|
+
state.hoistableTagVarsByScope.get(curScope);
|
|
64
|
+
|
|
65
|
+
if (hoistableTagVars) {
|
|
66
|
+
hoistableTagVars[name] = hoistableTagVars[name] ?
|
|
67
|
+
true :
|
|
68
|
+
binding;
|
|
69
|
+
} else {
|
|
70
|
+
state.hoistableTagVarsByScope.set(curScope, {
|
|
71
|
+
[name]: binding
|
|
72
|
+
});
|
|
73
|
+
}
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
this.traverse(visitor, state);
|
|
@@ -95,8 +95,8 @@ _traverse.Scope.prototype.crawl = function () {
|
|
|
95
95
|
if (hoistableBinding) {
|
|
96
96
|
if (hoistableBinding === true) {
|
|
97
97
|
throw ref.buildCodeFrameError(
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
"Ambiguous reference, variable was defined in multiple places and was not shadowed."
|
|
99
|
+
);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
const movedBinding = movedBindings.get(hoistableBinding);
|
|
@@ -117,9 +117,9 @@ const MarkoDefinitions = {
|
|
|
117
117
|
},
|
|
118
118
|
arguments: {
|
|
119
119
|
validate: (0, _utils.chain)(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
(0, _utils.assertValueType)("array"),
|
|
121
|
+
(0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement"))
|
|
122
|
+
),
|
|
123
123
|
optional: true
|
|
124
124
|
},
|
|
125
125
|
default: {
|
|
@@ -151,9 +151,9 @@ const MarkoDefinitions = {
|
|
|
151
151
|
fields: {
|
|
152
152
|
params: {
|
|
153
153
|
validate: (0, _utils.chain)(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
(0, _utils.assertValueType)("array"),
|
|
155
|
+
(0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement"))
|
|
156
|
+
),
|
|
157
157
|
default: []
|
|
158
158
|
},
|
|
159
159
|
body: {
|
|
@@ -163,8 +163,8 @@ const MarkoDefinitions = {
|
|
|
163
163
|
"MarkoText",
|
|
164
164
|
"MarkoPlaceholder",
|
|
165
165
|
"MarkoScriptlet",
|
|
166
|
-
"MarkoComment"]
|
|
167
|
-
|
|
166
|
+
"MarkoComment"]
|
|
167
|
+
),
|
|
168
168
|
default: []
|
|
169
169
|
}
|
|
170
170
|
}
|
|
@@ -187,9 +187,9 @@ const MarkoDefinitions = {
|
|
|
187
187
|
},
|
|
188
188
|
arguments: {
|
|
189
189
|
validate: (0, _utils.chain)(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
(0, _utils.assertValueType)("array"),
|
|
191
|
+
(0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement"))
|
|
192
|
+
),
|
|
193
193
|
optional: true
|
|
194
194
|
},
|
|
195
195
|
rawValue: {
|
|
@@ -207,5 +207,7 @@ const MarkoDefinitions = {
|
|
|
207
207
|
MarkoDefinitions;exports.default = _default;
|
|
208
208
|
const MARKO_TYPES = Object.keys(MarkoDefinitions);exports.MARKO_TYPES = MARKO_TYPES;
|
|
209
209
|
const MARKO_ALIAS_TYPES = Array.from(
|
|
210
|
-
new Set(
|
|
211
|
-
MARKO_TYPES.reduce((all, t) => all.concat(MarkoDefinitions[t].aliases), [])
|
|
210
|
+
new Set(
|
|
211
|
+
MARKO_TYPES.reduce((all, t) => all.concat(MarkoDefinitions[t].aliases), [])
|
|
212
|
+
)
|
|
213
|
+
);exports.MARKO_ALIAS_TYPES = MARKO_ALIAS_TYPES;
|
|
@@ -56,17 +56,17 @@ referencedValidators.default = (node, parent, grandparent) => {
|
|
|
56
56
|
case "MarkoTagBody":
|
|
57
57
|
return false;
|
|
58
58
|
default:
|
|
59
|
-
return originalIsReferenced(node, parent, grandparent);
|
|
60
|
-
|
|
59
|
+
return originalIsReferenced(node, parent, grandparent);
|
|
60
|
+
}
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
function assert(typeName, node, opts) {
|
|
64
64
|
if (!is(typeName, node, opts)) {
|
|
65
65
|
throw new Error(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
`Expected type "${typeName}" with option ${JSON.stringify(
|
|
67
|
+
opts
|
|
68
|
+
)}, but instead got "${node.type}".`
|
|
69
|
+
);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -76,8 +76,8 @@ function builder(type, args) {
|
|
|
76
76
|
const countArgs = args.length;
|
|
77
77
|
if (countArgs > keys.length) {
|
|
78
78
|
throw new Error(
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`
|
|
80
|
+
);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
const node = { type };
|
package/dist/register.js
CHANGED
|
@@ -26,18 +26,18 @@ register();
|
|
|
26
26
|
function register({ extensions = require.extensions, ...options } = {}) {
|
|
27
27
|
extensions[".marko"] = (module, filename) => {
|
|
28
28
|
const compiled = compiler.compileFileSync(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
filename,
|
|
30
|
+
Object.assign(
|
|
31
|
+
{
|
|
32
|
+
meta: true,
|
|
33
|
+
hot: process.env.BROWSER_REFRESH_URL !== undefined,
|
|
34
|
+
// eslint-disable-next-line no-constant-condition
|
|
35
|
+
sourceMaps: isDev ? "both" : false
|
|
36
|
+
},
|
|
37
|
+
options,
|
|
38
|
+
requiredOptions
|
|
39
|
+
)
|
|
40
|
+
);
|
|
41
41
|
|
|
42
42
|
if (compiled.map) {
|
|
43
43
|
sourceMaps.set(filename, compiled.map);
|
|
@@ -116,9 +116,9 @@ function find(dirname, registeredTaglibs) {
|
|
|
116
116
|
getAllDependencyNames(rootPkg).forEach((name) => {
|
|
117
117
|
if (!excludedPackages[name]) {
|
|
118
118
|
let taglibPath = resolveFrom(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
rootPkg.__dirname,
|
|
120
|
+
nodePath.join(name, "marko.json")
|
|
121
|
+
);
|
|
122
122
|
if (taglibPath) {
|
|
123
123
|
var taglib = taglibLoader.loadTaglibFromFile(taglibPath);
|
|
124
124
|
helper.addTaglib(taglib);
|