@vue/compiler-core 3.4.0-alpha.1 → 3.4.0-alpha.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/compiler-core.cjs.js +1791 -996
- package/dist/compiler-core.cjs.prod.js +1756 -956
- package/dist/compiler-core.d.ts +99 -89
- package/dist/compiler-core.esm-bundler.js +1688 -979
- package/package.json +6 -5
|
@@ -3,87 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var shared = require('@vue/shared');
|
|
6
|
+
var decode_js = require('entities/lib/decode.js');
|
|
6
7
|
var parser = require('@babel/parser');
|
|
7
8
|
var sourceMapJs = require('source-map-js');
|
|
8
9
|
var estreeWalker = require('estree-walker');
|
|
9
10
|
|
|
10
|
-
function defaultOnError(error) {
|
|
11
|
-
throw error;
|
|
12
|
-
}
|
|
13
|
-
function defaultOnWarn(msg) {
|
|
14
|
-
console.warn(`[Vue warn] ${msg.message}`);
|
|
15
|
-
}
|
|
16
|
-
function createCompilerError(code, loc, messages, additionalMessage) {
|
|
17
|
-
const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
|
|
18
|
-
const error = new SyntaxError(String(msg));
|
|
19
|
-
error.code = code;
|
|
20
|
-
error.loc = loc;
|
|
21
|
-
return error;
|
|
22
|
-
}
|
|
23
|
-
const errorMessages = {
|
|
24
|
-
// parse errors
|
|
25
|
-
[0]: "Illegal comment.",
|
|
26
|
-
[1]: "CDATA section is allowed only in XML context.",
|
|
27
|
-
[2]: "Duplicate attribute.",
|
|
28
|
-
[3]: "End tag cannot have attributes.",
|
|
29
|
-
[4]: "Illegal '/' in tags.",
|
|
30
|
-
[5]: "Unexpected EOF in tag.",
|
|
31
|
-
[6]: "Unexpected EOF in CDATA section.",
|
|
32
|
-
[7]: "Unexpected EOF in comment.",
|
|
33
|
-
[8]: "Unexpected EOF in script.",
|
|
34
|
-
[9]: "Unexpected EOF in tag.",
|
|
35
|
-
[10]: "Incorrectly closed comment.",
|
|
36
|
-
[11]: "Incorrectly opened comment.",
|
|
37
|
-
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
38
|
-
[13]: "Attribute value was expected.",
|
|
39
|
-
[14]: "End tag name was expected.",
|
|
40
|
-
[15]: "Whitespace was expected.",
|
|
41
|
-
[16]: "Unexpected '<!--' in comment.",
|
|
42
|
-
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
43
|
-
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
44
|
-
[19]: "Attribute name cannot start with '='.",
|
|
45
|
-
[21]: "'<?' is allowed only in XML context.",
|
|
46
|
-
[20]: `Unexpected null character.`,
|
|
47
|
-
[22]: "Illegal '/' in tags.",
|
|
48
|
-
// Vue-specific parse errors
|
|
49
|
-
[23]: "Invalid end tag.",
|
|
50
|
-
[24]: "Element is missing end tag.",
|
|
51
|
-
[25]: "Interpolation end sign was not found.",
|
|
52
|
-
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
53
|
-
[26]: "Legal directive name was expected.",
|
|
54
|
-
// transform errors
|
|
55
|
-
[28]: `v-if/v-else-if is missing expression.`,
|
|
56
|
-
[29]: `v-if/else branches must use unique keys.`,
|
|
57
|
-
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
58
|
-
[31]: `v-for is missing expression.`,
|
|
59
|
-
[32]: `v-for has invalid expression.`,
|
|
60
|
-
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
61
|
-
[34]: `v-bind is missing expression.`,
|
|
62
|
-
[35]: `v-on is missing expression.`,
|
|
63
|
-
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
64
|
-
[37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
|
|
65
|
-
[38]: `Duplicate slot names found. `,
|
|
66
|
-
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
67
|
-
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
68
|
-
[41]: `v-model is missing expression.`,
|
|
69
|
-
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
70
|
-
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
71
|
-
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
72
|
-
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
73
|
-
[45]: `Error parsing JavaScript expression: `,
|
|
74
|
-
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
75
|
-
// generic errors
|
|
76
|
-
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
77
|
-
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
78
|
-
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
79
|
-
[50]: `"scopeId" option is only supported in module mode.`,
|
|
80
|
-
// deprecations
|
|
81
|
-
[51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
|
|
82
|
-
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
83
|
-
// just to fulfill types
|
|
84
|
-
[53]: ``
|
|
85
|
-
};
|
|
86
|
-
|
|
87
11
|
const FRAGMENT = Symbol(`Fragment` );
|
|
88
12
|
const TELEPORT = Symbol(`Teleport` );
|
|
89
13
|
const SUSPENSE = Symbol(`Suspense` );
|
|
@@ -173,13 +97,14 @@ function registerRuntimeHelpers(helpers) {
|
|
|
173
97
|
}
|
|
174
98
|
|
|
175
99
|
const locStub = {
|
|
176
|
-
source: "",
|
|
177
100
|
start: { line: 1, column: 1, offset: 0 },
|
|
178
|
-
end: { line: 1, column: 1, offset: 0 }
|
|
101
|
+
end: { line: 1, column: 1, offset: 0 },
|
|
102
|
+
source: ""
|
|
179
103
|
};
|
|
180
|
-
function createRoot(children,
|
|
104
|
+
function createRoot(children, source = "") {
|
|
181
105
|
return {
|
|
182
106
|
type: 0,
|
|
107
|
+
source,
|
|
183
108
|
children,
|
|
184
109
|
helpers: /* @__PURE__ */ new Set(),
|
|
185
110
|
components: [],
|
|
@@ -189,7 +114,7 @@ function createRoot(children, loc = locStub) {
|
|
|
189
114
|
cached: 0,
|
|
190
115
|
temps: 0,
|
|
191
116
|
codegenNode: void 0,
|
|
192
|
-
loc
|
|
117
|
+
loc: locStub
|
|
193
118
|
};
|
|
194
119
|
}
|
|
195
120
|
function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
|
|
@@ -360,17 +285,1032 @@ function convertToBlock(node, { helper, removeHelper, inSSR }) {
|
|
|
360
285
|
}
|
|
361
286
|
}
|
|
362
287
|
|
|
288
|
+
const defaultDelimitersOpen = new Uint8Array([123, 123]);
|
|
289
|
+
const defaultDelimitersClose = new Uint8Array([125, 125]);
|
|
290
|
+
function isTagStartChar(c) {
|
|
291
|
+
return c >= 97 && c <= 122 || c >= 65 && c <= 90;
|
|
292
|
+
}
|
|
293
|
+
function isWhitespace(c) {
|
|
294
|
+
return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
|
|
295
|
+
}
|
|
296
|
+
function isEndOfTagSection(c) {
|
|
297
|
+
return c === 47 || c === 62 || isWhitespace(c);
|
|
298
|
+
}
|
|
299
|
+
function toCharCodes(str) {
|
|
300
|
+
const ret = new Uint8Array(str.length);
|
|
301
|
+
for (let i = 0; i < str.length; i++) {
|
|
302
|
+
ret[i] = str.charCodeAt(i);
|
|
303
|
+
}
|
|
304
|
+
return ret;
|
|
305
|
+
}
|
|
306
|
+
const Sequences = {
|
|
307
|
+
Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
|
|
308
|
+
// CDATA[
|
|
309
|
+
CdataEnd: new Uint8Array([93, 93, 62]),
|
|
310
|
+
// ]]>
|
|
311
|
+
CommentEnd: new Uint8Array([45, 45, 62]),
|
|
312
|
+
// `-->`
|
|
313
|
+
ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
|
|
314
|
+
// `<\/script`
|
|
315
|
+
StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
|
|
316
|
+
// `</style`
|
|
317
|
+
TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
|
|
318
|
+
// `</title`
|
|
319
|
+
TextareaEnd: new Uint8Array([
|
|
320
|
+
60,
|
|
321
|
+
47,
|
|
322
|
+
116,
|
|
323
|
+
101,
|
|
324
|
+
120,
|
|
325
|
+
116,
|
|
326
|
+
97,
|
|
327
|
+
114,
|
|
328
|
+
101,
|
|
329
|
+
97
|
|
330
|
+
])
|
|
331
|
+
// `</textarea
|
|
332
|
+
};
|
|
333
|
+
class Tokenizer {
|
|
334
|
+
constructor(stack, cbs) {
|
|
335
|
+
this.stack = stack;
|
|
336
|
+
this.cbs = cbs;
|
|
337
|
+
/** The current state the tokenizer is in. */
|
|
338
|
+
this.state = 1;
|
|
339
|
+
/** The read buffer. */
|
|
340
|
+
this.buffer = "";
|
|
341
|
+
/** The beginning of the section that is currently being read. */
|
|
342
|
+
this.sectionStart = 0;
|
|
343
|
+
/** The index within the buffer that we are currently looking at. */
|
|
344
|
+
this.index = 0;
|
|
345
|
+
/** The start of the last entity. */
|
|
346
|
+
this.entityStart = 0;
|
|
347
|
+
/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
|
|
348
|
+
this.baseState = 1;
|
|
349
|
+
/** For special parsing behavior inside of script and style tags. */
|
|
350
|
+
this.inRCDATA = false;
|
|
351
|
+
/** For disabling RCDATA tags handling */
|
|
352
|
+
this.inXML = false;
|
|
353
|
+
/** Reocrd newline positions for fast line / column calculation */
|
|
354
|
+
this.newlines = [];
|
|
355
|
+
this.mode = 0;
|
|
356
|
+
this.delimiterOpen = defaultDelimitersOpen;
|
|
357
|
+
this.delimiterClose = defaultDelimitersClose;
|
|
358
|
+
this.delimiterIndex = -1;
|
|
359
|
+
this.currentSequence = void 0;
|
|
360
|
+
this.sequenceIndex = 0;
|
|
361
|
+
{
|
|
362
|
+
this.entityDecoder = new decode_js.EntityDecoder(
|
|
363
|
+
decode_js.htmlDecodeTree,
|
|
364
|
+
(cp, consumed) => this.emitCodePoint(cp, consumed)
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
get inSFCRoot() {
|
|
369
|
+
return this.mode === 2 && this.stack.length === 0;
|
|
370
|
+
}
|
|
371
|
+
reset() {
|
|
372
|
+
this.state = 1;
|
|
373
|
+
this.mode = 0;
|
|
374
|
+
this.buffer = "";
|
|
375
|
+
this.sectionStart = 0;
|
|
376
|
+
this.index = 0;
|
|
377
|
+
this.baseState = 1;
|
|
378
|
+
this.currentSequence = void 0;
|
|
379
|
+
this.newlines.length = 0;
|
|
380
|
+
this.delimiterOpen = defaultDelimitersOpen;
|
|
381
|
+
this.delimiterClose = defaultDelimitersClose;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Generate Position object with line / column information using recorded
|
|
385
|
+
* newline positions. We know the index is always going to be an already
|
|
386
|
+
* processed index, so all the newlines up to this index should have been
|
|
387
|
+
* recorded.
|
|
388
|
+
*/
|
|
389
|
+
getPos(index) {
|
|
390
|
+
let line = 1;
|
|
391
|
+
let column = index + 1;
|
|
392
|
+
for (let i = this.newlines.length - 1; i >= 0; i--) {
|
|
393
|
+
const newlineIndex = this.newlines[i];
|
|
394
|
+
if (index > newlineIndex) {
|
|
395
|
+
line = i + 2;
|
|
396
|
+
column = index - newlineIndex;
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return {
|
|
401
|
+
column,
|
|
402
|
+
line,
|
|
403
|
+
offset: index
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
peek() {
|
|
407
|
+
return this.buffer.charCodeAt(this.index + 1);
|
|
408
|
+
}
|
|
409
|
+
stateText(c) {
|
|
410
|
+
if (c === 60) {
|
|
411
|
+
if (this.index > this.sectionStart) {
|
|
412
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
413
|
+
}
|
|
414
|
+
this.state = 5;
|
|
415
|
+
this.sectionStart = this.index;
|
|
416
|
+
} else if (c === 38) {
|
|
417
|
+
this.startEntity();
|
|
418
|
+
} else if (c === this.delimiterOpen[0]) {
|
|
419
|
+
this.state = 2;
|
|
420
|
+
this.delimiterIndex = 0;
|
|
421
|
+
this.stateInterpolationOpen(c);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
stateInterpolationOpen(c) {
|
|
425
|
+
if (c === this.delimiterOpen[this.delimiterIndex]) {
|
|
426
|
+
if (this.delimiterIndex === this.delimiterOpen.length - 1) {
|
|
427
|
+
const start = this.index + 1 - this.delimiterOpen.length;
|
|
428
|
+
if (start > this.sectionStart) {
|
|
429
|
+
this.cbs.ontext(this.sectionStart, start);
|
|
430
|
+
}
|
|
431
|
+
this.state = 3;
|
|
432
|
+
this.sectionStart = start;
|
|
433
|
+
} else {
|
|
434
|
+
this.delimiterIndex++;
|
|
435
|
+
}
|
|
436
|
+
} else if (this.inRCDATA) {
|
|
437
|
+
this.state = 32;
|
|
438
|
+
this.stateInRCDATA(c);
|
|
439
|
+
} else {
|
|
440
|
+
this.state = 1;
|
|
441
|
+
this.stateText(c);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
stateInterpolation(c) {
|
|
445
|
+
if (c === this.delimiterClose[0]) {
|
|
446
|
+
this.state = 4;
|
|
447
|
+
this.delimiterIndex = 0;
|
|
448
|
+
this.stateInterpolationClose(c);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
stateInterpolationClose(c) {
|
|
452
|
+
if (c === this.delimiterClose[this.delimiterIndex]) {
|
|
453
|
+
if (this.delimiterIndex === this.delimiterClose.length - 1) {
|
|
454
|
+
this.cbs.oninterpolation(this.sectionStart, this.index + 1);
|
|
455
|
+
if (this.inRCDATA) {
|
|
456
|
+
this.state = 32;
|
|
457
|
+
} else {
|
|
458
|
+
this.state = 1;
|
|
459
|
+
}
|
|
460
|
+
this.sectionStart = this.index + 1;
|
|
461
|
+
} else {
|
|
462
|
+
this.delimiterIndex++;
|
|
463
|
+
}
|
|
464
|
+
} else {
|
|
465
|
+
this.state = 3;
|
|
466
|
+
this.stateInterpolation(c);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
stateSpecialStartSequence(c) {
|
|
470
|
+
const isEnd = this.sequenceIndex === this.currentSequence.length;
|
|
471
|
+
const isMatch = isEnd ? (
|
|
472
|
+
// If we are at the end of the sequence, make sure the tag name has ended
|
|
473
|
+
isEndOfTagSection(c)
|
|
474
|
+
) : (
|
|
475
|
+
// Otherwise, do a case-insensitive comparison
|
|
476
|
+
(c | 32) === this.currentSequence[this.sequenceIndex]
|
|
477
|
+
);
|
|
478
|
+
if (!isMatch) {
|
|
479
|
+
this.inRCDATA = false;
|
|
480
|
+
} else if (!isEnd) {
|
|
481
|
+
this.sequenceIndex++;
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
this.sequenceIndex = 0;
|
|
485
|
+
this.state = 6;
|
|
486
|
+
this.stateInTagName(c);
|
|
487
|
+
}
|
|
488
|
+
/** Look for an end tag. For <title> and <textarea>, also decode entities. */
|
|
489
|
+
stateInRCDATA(c) {
|
|
490
|
+
if (this.sequenceIndex === this.currentSequence.length) {
|
|
491
|
+
if (c === 62 || isWhitespace(c)) {
|
|
492
|
+
const endOfText = this.index - this.currentSequence.length;
|
|
493
|
+
if (this.sectionStart < endOfText) {
|
|
494
|
+
const actualIndex = this.index;
|
|
495
|
+
this.index = endOfText;
|
|
496
|
+
this.cbs.ontext(this.sectionStart, endOfText);
|
|
497
|
+
this.index = actualIndex;
|
|
498
|
+
}
|
|
499
|
+
this.sectionStart = endOfText + 2;
|
|
500
|
+
this.stateInClosingTagName(c);
|
|
501
|
+
this.inRCDATA = false;
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
this.sequenceIndex = 0;
|
|
505
|
+
}
|
|
506
|
+
if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
|
|
507
|
+
this.sequenceIndex += 1;
|
|
508
|
+
} else if (this.sequenceIndex === 0) {
|
|
509
|
+
if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
|
|
510
|
+
if (c === 38) {
|
|
511
|
+
this.startEntity();
|
|
512
|
+
} else if (c === this.delimiterOpen[0]) {
|
|
513
|
+
this.state = 2;
|
|
514
|
+
this.delimiterIndex = 0;
|
|
515
|
+
this.stateInterpolationOpen(c);
|
|
516
|
+
}
|
|
517
|
+
} else if (this.fastForwardTo(60)) {
|
|
518
|
+
this.sequenceIndex = 1;
|
|
519
|
+
}
|
|
520
|
+
} else {
|
|
521
|
+
this.sequenceIndex = Number(c === 60);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
stateCDATASequence(c) {
|
|
525
|
+
if (c === Sequences.Cdata[this.sequenceIndex]) {
|
|
526
|
+
if (++this.sequenceIndex === Sequences.Cdata.length) {
|
|
527
|
+
this.state = 28;
|
|
528
|
+
this.currentSequence = Sequences.CdataEnd;
|
|
529
|
+
this.sequenceIndex = 0;
|
|
530
|
+
this.sectionStart = this.index + 1;
|
|
531
|
+
}
|
|
532
|
+
} else {
|
|
533
|
+
this.sequenceIndex = 0;
|
|
534
|
+
this.state = 23;
|
|
535
|
+
this.stateInDeclaration(c);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* When we wait for one specific character, we can speed things up
|
|
540
|
+
* by skipping through the buffer until we find it.
|
|
541
|
+
*
|
|
542
|
+
* @returns Whether the character was found.
|
|
543
|
+
*/
|
|
544
|
+
fastForwardTo(c) {
|
|
545
|
+
while (++this.index < this.buffer.length) {
|
|
546
|
+
const cc = this.buffer.charCodeAt(this.index);
|
|
547
|
+
if (cc === 10) {
|
|
548
|
+
this.newlines.push(this.index);
|
|
549
|
+
}
|
|
550
|
+
if (cc === c) {
|
|
551
|
+
return true;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
this.index = this.buffer.length - 1;
|
|
555
|
+
return false;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Comments and CDATA end with `-->` and `]]>`.
|
|
559
|
+
*
|
|
560
|
+
* Their common qualities are:
|
|
561
|
+
* - Their end sequences have a distinct character they start with.
|
|
562
|
+
* - That character is then repeated, so we have to check multiple repeats.
|
|
563
|
+
* - All characters but the start character of the sequence can be skipped.
|
|
564
|
+
*/
|
|
565
|
+
stateInCommentLike(c) {
|
|
566
|
+
if (c === this.currentSequence[this.sequenceIndex]) {
|
|
567
|
+
if (++this.sequenceIndex === this.currentSequence.length) {
|
|
568
|
+
if (this.currentSequence === Sequences.CdataEnd) {
|
|
569
|
+
this.cbs.oncdata(this.sectionStart, this.index - 2);
|
|
570
|
+
} else {
|
|
571
|
+
this.cbs.oncomment(this.sectionStart, this.index - 2);
|
|
572
|
+
}
|
|
573
|
+
this.sequenceIndex = 0;
|
|
574
|
+
this.sectionStart = this.index + 1;
|
|
575
|
+
this.state = 1;
|
|
576
|
+
}
|
|
577
|
+
} else if (this.sequenceIndex === 0) {
|
|
578
|
+
if (this.fastForwardTo(this.currentSequence[0])) {
|
|
579
|
+
this.sequenceIndex = 1;
|
|
580
|
+
}
|
|
581
|
+
} else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
|
|
582
|
+
this.sequenceIndex = 0;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
startSpecial(sequence, offset) {
|
|
586
|
+
this.enterRCDATA(sequence, offset);
|
|
587
|
+
this.state = 31;
|
|
588
|
+
}
|
|
589
|
+
enterRCDATA(sequence, offset) {
|
|
590
|
+
this.inRCDATA = true;
|
|
591
|
+
this.currentSequence = sequence;
|
|
592
|
+
this.sequenceIndex = offset;
|
|
593
|
+
}
|
|
594
|
+
stateBeforeTagName(c) {
|
|
595
|
+
if (c === 33) {
|
|
596
|
+
this.state = 22;
|
|
597
|
+
this.sectionStart = this.index + 1;
|
|
598
|
+
} else if (c === 63) {
|
|
599
|
+
this.state = 24;
|
|
600
|
+
this.sectionStart = this.index + 1;
|
|
601
|
+
} else if (isTagStartChar(c)) {
|
|
602
|
+
this.sectionStart = this.index;
|
|
603
|
+
if (this.mode === 0) {
|
|
604
|
+
this.state = 6;
|
|
605
|
+
} else if (this.inSFCRoot) {
|
|
606
|
+
this.state = 34;
|
|
607
|
+
} else if (!this.inXML) {
|
|
608
|
+
const lower = c | 32;
|
|
609
|
+
if (lower === 116) {
|
|
610
|
+
this.state = 30;
|
|
611
|
+
} else {
|
|
612
|
+
this.state = lower === 115 ? 29 : 6;
|
|
613
|
+
}
|
|
614
|
+
} else {
|
|
615
|
+
this.state = 6;
|
|
616
|
+
}
|
|
617
|
+
} else if (c === 47) {
|
|
618
|
+
this.state = 8;
|
|
619
|
+
} else {
|
|
620
|
+
this.state = 1;
|
|
621
|
+
this.stateText(c);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
stateInTagName(c) {
|
|
625
|
+
if (isEndOfTagSection(c)) {
|
|
626
|
+
this.handleTagName(c);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
stateInSFCRootTagName(c) {
|
|
630
|
+
if (isEndOfTagSection(c)) {
|
|
631
|
+
const tag = this.buffer.slice(this.sectionStart, this.index);
|
|
632
|
+
if (tag !== "template") {
|
|
633
|
+
this.enterRCDATA(toCharCodes(`</` + tag), 0);
|
|
634
|
+
}
|
|
635
|
+
this.handleTagName(c);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
handleTagName(c) {
|
|
639
|
+
this.cbs.onopentagname(this.sectionStart, this.index);
|
|
640
|
+
this.sectionStart = -1;
|
|
641
|
+
this.state = 11;
|
|
642
|
+
this.stateBeforeAttrName(c);
|
|
643
|
+
}
|
|
644
|
+
stateBeforeClosingTagName(c) {
|
|
645
|
+
if (isWhitespace(c)) ; else if (c === 62) {
|
|
646
|
+
{
|
|
647
|
+
this.cbs.onerr(14, this.index);
|
|
648
|
+
}
|
|
649
|
+
this.state = 1;
|
|
650
|
+
this.sectionStart = this.index + 1;
|
|
651
|
+
} else {
|
|
652
|
+
this.state = isTagStartChar(c) ? 9 : 27;
|
|
653
|
+
this.sectionStart = this.index;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
stateInClosingTagName(c) {
|
|
657
|
+
if (c === 62 || isWhitespace(c)) {
|
|
658
|
+
this.cbs.onclosetag(this.sectionStart, this.index);
|
|
659
|
+
this.sectionStart = -1;
|
|
660
|
+
this.state = 10;
|
|
661
|
+
this.stateAfterClosingTagName(c);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
stateAfterClosingTagName(c) {
|
|
665
|
+
if (c === 62) {
|
|
666
|
+
this.state = 1;
|
|
667
|
+
this.sectionStart = this.index + 1;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
stateBeforeAttrName(c) {
|
|
671
|
+
if (c === 62) {
|
|
672
|
+
this.cbs.onopentagend(this.index);
|
|
673
|
+
if (this.inRCDATA) {
|
|
674
|
+
this.state = 32;
|
|
675
|
+
} else {
|
|
676
|
+
this.state = 1;
|
|
677
|
+
}
|
|
678
|
+
this.sectionStart = this.index + 1;
|
|
679
|
+
} else if (c === 47) {
|
|
680
|
+
this.state = 7;
|
|
681
|
+
if (this.peek() !== 62) {
|
|
682
|
+
this.cbs.onerr(22, this.index);
|
|
683
|
+
}
|
|
684
|
+
} else if (c === 60 && this.peek() === 47) {
|
|
685
|
+
this.cbs.onopentagend(this.index);
|
|
686
|
+
this.state = 5;
|
|
687
|
+
this.sectionStart = this.index;
|
|
688
|
+
} else if (!isWhitespace(c)) {
|
|
689
|
+
if (c === 61) {
|
|
690
|
+
this.cbs.onerr(
|
|
691
|
+
19,
|
|
692
|
+
this.index
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
this.handleAttrStart(c);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
handleAttrStart(c) {
|
|
699
|
+
if (c === 118 && this.peek() === 45) {
|
|
700
|
+
this.state = 13;
|
|
701
|
+
this.sectionStart = this.index;
|
|
702
|
+
} else if (c === 46 || c === 58 || c === 64 || c === 35) {
|
|
703
|
+
this.cbs.ondirname(this.index, this.index + 1);
|
|
704
|
+
this.state = 14;
|
|
705
|
+
this.sectionStart = this.index + 1;
|
|
706
|
+
} else {
|
|
707
|
+
this.state = 12;
|
|
708
|
+
this.sectionStart = this.index;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
stateInSelfClosingTag(c) {
|
|
712
|
+
if (c === 62) {
|
|
713
|
+
this.cbs.onselfclosingtag(this.index);
|
|
714
|
+
this.state = 1;
|
|
715
|
+
this.sectionStart = this.index + 1;
|
|
716
|
+
this.inRCDATA = false;
|
|
717
|
+
} else if (!isWhitespace(c)) {
|
|
718
|
+
this.state = 11;
|
|
719
|
+
this.stateBeforeAttrName(c);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
stateInAttrName(c) {
|
|
723
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
724
|
+
this.cbs.onattribname(this.sectionStart, this.index);
|
|
725
|
+
this.handleAttrNameEnd(c);
|
|
726
|
+
} else if (c === 34 || c === 39 || c === 60) {
|
|
727
|
+
this.cbs.onerr(
|
|
728
|
+
17,
|
|
729
|
+
this.index
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
stateInDirName(c) {
|
|
734
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
735
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
736
|
+
this.handleAttrNameEnd(c);
|
|
737
|
+
} else if (c === 58) {
|
|
738
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
739
|
+
this.state = 14;
|
|
740
|
+
this.sectionStart = this.index + 1;
|
|
741
|
+
} else if (c === 46) {
|
|
742
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
743
|
+
this.state = 16;
|
|
744
|
+
this.sectionStart = this.index + 1;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
stateInDirArg(c) {
|
|
748
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
749
|
+
this.cbs.ondirarg(this.sectionStart, this.index);
|
|
750
|
+
this.handleAttrNameEnd(c);
|
|
751
|
+
} else if (c === 91) {
|
|
752
|
+
this.state = 15;
|
|
753
|
+
} else if (c === 46) {
|
|
754
|
+
this.cbs.ondirarg(this.sectionStart, this.index);
|
|
755
|
+
this.state = 16;
|
|
756
|
+
this.sectionStart = this.index + 1;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
stateInDynamicDirArg(c) {
|
|
760
|
+
if (c === 93) {
|
|
761
|
+
this.state = 14;
|
|
762
|
+
} else if (c === 61 || isEndOfTagSection(c)) {
|
|
763
|
+
this.cbs.ondirarg(this.sectionStart, this.index + 1);
|
|
764
|
+
this.handleAttrNameEnd(c);
|
|
765
|
+
{
|
|
766
|
+
this.cbs.onerr(
|
|
767
|
+
27,
|
|
768
|
+
this.index
|
|
769
|
+
);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
stateInDirModifier(c) {
|
|
774
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
775
|
+
this.cbs.ondirmodifier(this.sectionStart, this.index);
|
|
776
|
+
this.handleAttrNameEnd(c);
|
|
777
|
+
} else if (c === 46) {
|
|
778
|
+
this.cbs.ondirmodifier(this.sectionStart, this.index);
|
|
779
|
+
this.sectionStart = this.index + 1;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
handleAttrNameEnd(c) {
|
|
783
|
+
this.sectionStart = this.index;
|
|
784
|
+
this.state = 17;
|
|
785
|
+
this.cbs.onattribnameend(this.index);
|
|
786
|
+
this.stateAfterAttrName(c);
|
|
787
|
+
}
|
|
788
|
+
stateAfterAttrName(c) {
|
|
789
|
+
if (c === 61) {
|
|
790
|
+
this.state = 18;
|
|
791
|
+
} else if (c === 47 || c === 62) {
|
|
792
|
+
this.cbs.onattribend(0, this.sectionStart);
|
|
793
|
+
this.sectionStart = -1;
|
|
794
|
+
this.state = 11;
|
|
795
|
+
this.stateBeforeAttrName(c);
|
|
796
|
+
} else if (!isWhitespace(c)) {
|
|
797
|
+
this.cbs.onattribend(0, this.sectionStart);
|
|
798
|
+
this.handleAttrStart(c);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
stateBeforeAttrValue(c) {
|
|
802
|
+
if (c === 34) {
|
|
803
|
+
this.state = 19;
|
|
804
|
+
this.sectionStart = this.index + 1;
|
|
805
|
+
} else if (c === 39) {
|
|
806
|
+
this.state = 20;
|
|
807
|
+
this.sectionStart = this.index + 1;
|
|
808
|
+
} else if (!isWhitespace(c)) {
|
|
809
|
+
this.sectionStart = this.index;
|
|
810
|
+
this.state = 21;
|
|
811
|
+
this.stateInAttrValueNoQuotes(c);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
handleInAttrValue(c, quote) {
|
|
815
|
+
if (c === quote || false) {
|
|
816
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
817
|
+
this.sectionStart = -1;
|
|
818
|
+
this.cbs.onattribend(
|
|
819
|
+
quote === 34 ? 3 : 2,
|
|
820
|
+
this.index + 1
|
|
821
|
+
);
|
|
822
|
+
this.state = 11;
|
|
823
|
+
} else if (c === 38) {
|
|
824
|
+
this.startEntity();
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
stateInAttrValueDoubleQuotes(c) {
|
|
828
|
+
this.handleInAttrValue(c, 34);
|
|
829
|
+
}
|
|
830
|
+
stateInAttrValueSingleQuotes(c) {
|
|
831
|
+
this.handleInAttrValue(c, 39);
|
|
832
|
+
}
|
|
833
|
+
stateInAttrValueNoQuotes(c) {
|
|
834
|
+
if (isWhitespace(c) || c === 62) {
|
|
835
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
836
|
+
this.sectionStart = -1;
|
|
837
|
+
this.cbs.onattribend(1, this.index);
|
|
838
|
+
this.state = 11;
|
|
839
|
+
this.stateBeforeAttrName(c);
|
|
840
|
+
} else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
|
|
841
|
+
this.cbs.onerr(
|
|
842
|
+
18,
|
|
843
|
+
this.index
|
|
844
|
+
);
|
|
845
|
+
} else if (c === 38) {
|
|
846
|
+
this.startEntity();
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
stateBeforeDeclaration(c) {
|
|
850
|
+
if (c === 91) {
|
|
851
|
+
this.state = 26;
|
|
852
|
+
this.sequenceIndex = 0;
|
|
853
|
+
} else {
|
|
854
|
+
this.state = c === 45 ? 25 : 23;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
stateInDeclaration(c) {
|
|
858
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
859
|
+
this.state = 1;
|
|
860
|
+
this.sectionStart = this.index + 1;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
stateInProcessingInstruction(c) {
|
|
864
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
865
|
+
this.cbs.onprocessinginstruction(this.sectionStart, this.index);
|
|
866
|
+
this.state = 1;
|
|
867
|
+
this.sectionStart = this.index + 1;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
stateBeforeComment(c) {
|
|
871
|
+
if (c === 45) {
|
|
872
|
+
this.state = 28;
|
|
873
|
+
this.currentSequence = Sequences.CommentEnd;
|
|
874
|
+
this.sequenceIndex = 2;
|
|
875
|
+
this.sectionStart = this.index + 1;
|
|
876
|
+
} else {
|
|
877
|
+
this.state = 23;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
stateInSpecialComment(c) {
|
|
881
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
882
|
+
this.cbs.oncomment(this.sectionStart, this.index);
|
|
883
|
+
this.state = 1;
|
|
884
|
+
this.sectionStart = this.index + 1;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
stateBeforeSpecialS(c) {
|
|
888
|
+
const lower = c | 32;
|
|
889
|
+
if (lower === Sequences.ScriptEnd[3]) {
|
|
890
|
+
this.startSpecial(Sequences.ScriptEnd, 4);
|
|
891
|
+
} else if (lower === Sequences.StyleEnd[3]) {
|
|
892
|
+
this.startSpecial(Sequences.StyleEnd, 4);
|
|
893
|
+
} else {
|
|
894
|
+
this.state = 6;
|
|
895
|
+
this.stateInTagName(c);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
stateBeforeSpecialT(c) {
|
|
899
|
+
const lower = c | 32;
|
|
900
|
+
if (lower === Sequences.TitleEnd[3]) {
|
|
901
|
+
this.startSpecial(Sequences.TitleEnd, 4);
|
|
902
|
+
} else if (lower === Sequences.TextareaEnd[3]) {
|
|
903
|
+
this.startSpecial(Sequences.TextareaEnd, 4);
|
|
904
|
+
} else {
|
|
905
|
+
this.state = 6;
|
|
906
|
+
this.stateInTagName(c);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
startEntity() {
|
|
910
|
+
{
|
|
911
|
+
this.baseState = this.state;
|
|
912
|
+
this.state = 33;
|
|
913
|
+
this.entityStart = this.index;
|
|
914
|
+
this.entityDecoder.startEntity(
|
|
915
|
+
this.baseState === 1 || this.baseState === 32 ? decode_js.DecodingMode.Legacy : decode_js.DecodingMode.Attribute
|
|
916
|
+
);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
stateInEntity() {
|
|
920
|
+
{
|
|
921
|
+
const length = this.entityDecoder.write(this.buffer, this.index);
|
|
922
|
+
if (length >= 0) {
|
|
923
|
+
this.state = this.baseState;
|
|
924
|
+
if (length === 0) {
|
|
925
|
+
this.index = this.entityStart;
|
|
926
|
+
}
|
|
927
|
+
} else {
|
|
928
|
+
this.index = this.buffer.length - 1;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Iterates through the buffer, calling the function corresponding to the current state.
|
|
934
|
+
*
|
|
935
|
+
* States that are more likely to be hit are higher up, as a performance improvement.
|
|
936
|
+
*/
|
|
937
|
+
parse(input) {
|
|
938
|
+
this.buffer = input;
|
|
939
|
+
while (this.index < this.buffer.length) {
|
|
940
|
+
const c = this.buffer.charCodeAt(this.index);
|
|
941
|
+
if (c === 10) {
|
|
942
|
+
this.newlines.push(this.index);
|
|
943
|
+
}
|
|
944
|
+
switch (this.state) {
|
|
945
|
+
case 1: {
|
|
946
|
+
this.stateText(c);
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
949
|
+
case 2: {
|
|
950
|
+
this.stateInterpolationOpen(c);
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
case 3: {
|
|
954
|
+
this.stateInterpolation(c);
|
|
955
|
+
break;
|
|
956
|
+
}
|
|
957
|
+
case 4: {
|
|
958
|
+
this.stateInterpolationClose(c);
|
|
959
|
+
break;
|
|
960
|
+
}
|
|
961
|
+
case 31: {
|
|
962
|
+
this.stateSpecialStartSequence(c);
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
case 32: {
|
|
966
|
+
this.stateInRCDATA(c);
|
|
967
|
+
break;
|
|
968
|
+
}
|
|
969
|
+
case 26: {
|
|
970
|
+
this.stateCDATASequence(c);
|
|
971
|
+
break;
|
|
972
|
+
}
|
|
973
|
+
case 19: {
|
|
974
|
+
this.stateInAttrValueDoubleQuotes(c);
|
|
975
|
+
break;
|
|
976
|
+
}
|
|
977
|
+
case 12: {
|
|
978
|
+
this.stateInAttrName(c);
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
case 13: {
|
|
982
|
+
this.stateInDirName(c);
|
|
983
|
+
break;
|
|
984
|
+
}
|
|
985
|
+
case 14: {
|
|
986
|
+
this.stateInDirArg(c);
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
case 15: {
|
|
990
|
+
this.stateInDynamicDirArg(c);
|
|
991
|
+
break;
|
|
992
|
+
}
|
|
993
|
+
case 16: {
|
|
994
|
+
this.stateInDirModifier(c);
|
|
995
|
+
break;
|
|
996
|
+
}
|
|
997
|
+
case 28: {
|
|
998
|
+
this.stateInCommentLike(c);
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
case 27: {
|
|
1002
|
+
this.stateInSpecialComment(c);
|
|
1003
|
+
break;
|
|
1004
|
+
}
|
|
1005
|
+
case 11: {
|
|
1006
|
+
this.stateBeforeAttrName(c);
|
|
1007
|
+
break;
|
|
1008
|
+
}
|
|
1009
|
+
case 6: {
|
|
1010
|
+
this.stateInTagName(c);
|
|
1011
|
+
break;
|
|
1012
|
+
}
|
|
1013
|
+
case 34: {
|
|
1014
|
+
this.stateInSFCRootTagName(c);
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1017
|
+
case 9: {
|
|
1018
|
+
this.stateInClosingTagName(c);
|
|
1019
|
+
break;
|
|
1020
|
+
}
|
|
1021
|
+
case 5: {
|
|
1022
|
+
this.stateBeforeTagName(c);
|
|
1023
|
+
break;
|
|
1024
|
+
}
|
|
1025
|
+
case 17: {
|
|
1026
|
+
this.stateAfterAttrName(c);
|
|
1027
|
+
break;
|
|
1028
|
+
}
|
|
1029
|
+
case 20: {
|
|
1030
|
+
this.stateInAttrValueSingleQuotes(c);
|
|
1031
|
+
break;
|
|
1032
|
+
}
|
|
1033
|
+
case 18: {
|
|
1034
|
+
this.stateBeforeAttrValue(c);
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
case 8: {
|
|
1038
|
+
this.stateBeforeClosingTagName(c);
|
|
1039
|
+
break;
|
|
1040
|
+
}
|
|
1041
|
+
case 10: {
|
|
1042
|
+
this.stateAfterClosingTagName(c);
|
|
1043
|
+
break;
|
|
1044
|
+
}
|
|
1045
|
+
case 29: {
|
|
1046
|
+
this.stateBeforeSpecialS(c);
|
|
1047
|
+
break;
|
|
1048
|
+
}
|
|
1049
|
+
case 30: {
|
|
1050
|
+
this.stateBeforeSpecialT(c);
|
|
1051
|
+
break;
|
|
1052
|
+
}
|
|
1053
|
+
case 21: {
|
|
1054
|
+
this.stateInAttrValueNoQuotes(c);
|
|
1055
|
+
break;
|
|
1056
|
+
}
|
|
1057
|
+
case 7: {
|
|
1058
|
+
this.stateInSelfClosingTag(c);
|
|
1059
|
+
break;
|
|
1060
|
+
}
|
|
1061
|
+
case 23: {
|
|
1062
|
+
this.stateInDeclaration(c);
|
|
1063
|
+
break;
|
|
1064
|
+
}
|
|
1065
|
+
case 22: {
|
|
1066
|
+
this.stateBeforeDeclaration(c);
|
|
1067
|
+
break;
|
|
1068
|
+
}
|
|
1069
|
+
case 25: {
|
|
1070
|
+
this.stateBeforeComment(c);
|
|
1071
|
+
break;
|
|
1072
|
+
}
|
|
1073
|
+
case 24: {
|
|
1074
|
+
this.stateInProcessingInstruction(c);
|
|
1075
|
+
break;
|
|
1076
|
+
}
|
|
1077
|
+
case 33: {
|
|
1078
|
+
this.stateInEntity();
|
|
1079
|
+
break;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
this.index++;
|
|
1083
|
+
}
|
|
1084
|
+
this.cleanup();
|
|
1085
|
+
this.finish();
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Remove data that has already been consumed from the buffer.
|
|
1089
|
+
*/
|
|
1090
|
+
cleanup() {
|
|
1091
|
+
if (this.sectionStart !== this.index) {
|
|
1092
|
+
if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
|
|
1093
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
1094
|
+
this.sectionStart = this.index;
|
|
1095
|
+
} else if (this.state === 19 || this.state === 20 || this.state === 21) {
|
|
1096
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
1097
|
+
this.sectionStart = this.index;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
finish() {
|
|
1102
|
+
if (this.state === 33) {
|
|
1103
|
+
this.entityDecoder.end();
|
|
1104
|
+
this.state = this.baseState;
|
|
1105
|
+
}
|
|
1106
|
+
this.handleTrailingData();
|
|
1107
|
+
this.cbs.onend();
|
|
1108
|
+
}
|
|
1109
|
+
/** Handle any trailing data. */
|
|
1110
|
+
handleTrailingData() {
|
|
1111
|
+
const endIndex = this.buffer.length;
|
|
1112
|
+
if (this.sectionStart >= endIndex) {
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
if (this.state === 28) {
|
|
1116
|
+
if (this.currentSequence === Sequences.CdataEnd) {
|
|
1117
|
+
this.cbs.oncdata(this.sectionStart, endIndex);
|
|
1118
|
+
} else {
|
|
1119
|
+
this.cbs.oncomment(this.sectionStart, endIndex);
|
|
1120
|
+
}
|
|
1121
|
+
} else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else {
|
|
1122
|
+
this.cbs.ontext(this.sectionStart, endIndex);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
emitCodePoint(cp, consumed) {
|
|
1126
|
+
{
|
|
1127
|
+
if (this.baseState !== 1 && this.baseState !== 32) {
|
|
1128
|
+
if (this.sectionStart < this.entityStart) {
|
|
1129
|
+
this.cbs.onattribdata(this.sectionStart, this.entityStart);
|
|
1130
|
+
}
|
|
1131
|
+
this.sectionStart = this.entityStart + consumed;
|
|
1132
|
+
this.index = this.sectionStart - 1;
|
|
1133
|
+
this.cbs.onattribentity(
|
|
1134
|
+
decode_js.fromCodePoint(cp),
|
|
1135
|
+
this.entityStart,
|
|
1136
|
+
this.sectionStart
|
|
1137
|
+
);
|
|
1138
|
+
} else {
|
|
1139
|
+
if (this.sectionStart < this.entityStart) {
|
|
1140
|
+
this.cbs.ontext(this.sectionStart, this.entityStart);
|
|
1141
|
+
}
|
|
1142
|
+
this.sectionStart = this.entityStart + consumed;
|
|
1143
|
+
this.index = this.sectionStart - 1;
|
|
1144
|
+
this.cbs.ontextentity(
|
|
1145
|
+
decode_js.fromCodePoint(cp),
|
|
1146
|
+
this.entityStart,
|
|
1147
|
+
this.sectionStart
|
|
1148
|
+
);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
const deprecationData = {
|
|
1155
|
+
["COMPILER_IS_ON_ELEMENT"]: {
|
|
1156
|
+
message: `Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".`,
|
|
1157
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
|
|
1158
|
+
},
|
|
1159
|
+
["COMPILER_V_BIND_SYNC"]: {
|
|
1160
|
+
message: (key) => `.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${key}.sync\` should be changed to \`v-model:${key}\`.`,
|
|
1161
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
|
|
1162
|
+
},
|
|
1163
|
+
["COMPILER_V_BIND_OBJECT_ORDER"]: {
|
|
1164
|
+
message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.`,
|
|
1165
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
|
|
1166
|
+
},
|
|
1167
|
+
["COMPILER_V_ON_NATIVE"]: {
|
|
1168
|
+
message: `.native modifier for v-on has been removed as is no longer necessary.`,
|
|
1169
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
|
|
1170
|
+
},
|
|
1171
|
+
["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
|
|
1172
|
+
message: `v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.`,
|
|
1173
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
|
|
1174
|
+
},
|
|
1175
|
+
["COMPILER_NATIVE_TEMPLATE"]: {
|
|
1176
|
+
message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
|
|
1177
|
+
},
|
|
1178
|
+
["COMPILER_INLINE_TEMPLATE"]: {
|
|
1179
|
+
message: `"inline-template" has been removed in Vue 3.`,
|
|
1180
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
|
|
1181
|
+
},
|
|
1182
|
+
["COMPILER_FILTER"]: {
|
|
1183
|
+
message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`,
|
|
1184
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
function getCompatValue(key, { compatConfig }) {
|
|
1188
|
+
const value = compatConfig && compatConfig[key];
|
|
1189
|
+
if (key === "MODE") {
|
|
1190
|
+
return value || 3;
|
|
1191
|
+
} else {
|
|
1192
|
+
return value;
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
function isCompatEnabled(key, context) {
|
|
1196
|
+
const mode = getCompatValue("MODE", context);
|
|
1197
|
+
const value = getCompatValue(key, context);
|
|
1198
|
+
return mode === 3 ? value === true : value !== false;
|
|
1199
|
+
}
|
|
1200
|
+
function checkCompatEnabled(key, context, loc, ...args) {
|
|
1201
|
+
const enabled = isCompatEnabled(key, context);
|
|
1202
|
+
if (enabled) {
|
|
1203
|
+
warnDeprecation(key, context, loc, ...args);
|
|
1204
|
+
}
|
|
1205
|
+
return enabled;
|
|
1206
|
+
}
|
|
1207
|
+
function warnDeprecation(key, context, loc, ...args) {
|
|
1208
|
+
const val = getCompatValue(key, context);
|
|
1209
|
+
if (val === "suppress-warning") {
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
const { message, link } = deprecationData[key];
|
|
1213
|
+
const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
|
|
1214
|
+
Details: ${link}` : ``}`;
|
|
1215
|
+
const err = new SyntaxError(msg);
|
|
1216
|
+
err.code = key;
|
|
1217
|
+
if (loc)
|
|
1218
|
+
err.loc = loc;
|
|
1219
|
+
context.onWarn(err);
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
function defaultOnError(error) {
|
|
1223
|
+
throw error;
|
|
1224
|
+
}
|
|
1225
|
+
function defaultOnWarn(msg) {
|
|
1226
|
+
console.warn(`[Vue warn] ${msg.message}`);
|
|
1227
|
+
}
|
|
1228
|
+
function createCompilerError(code, loc, messages, additionalMessage) {
|
|
1229
|
+
const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
|
|
1230
|
+
const error = new SyntaxError(String(msg));
|
|
1231
|
+
error.code = code;
|
|
1232
|
+
error.loc = loc;
|
|
1233
|
+
return error;
|
|
1234
|
+
}
|
|
1235
|
+
const errorMessages = {
|
|
1236
|
+
// parse errors
|
|
1237
|
+
[0]: "Illegal comment.",
|
|
1238
|
+
[1]: "CDATA section is allowed only in XML context.",
|
|
1239
|
+
[2]: "Duplicate attribute.",
|
|
1240
|
+
[3]: "End tag cannot have attributes.",
|
|
1241
|
+
[4]: "Illegal '/' in tags.",
|
|
1242
|
+
[5]: "Unexpected EOF in tag.",
|
|
1243
|
+
[6]: "Unexpected EOF in CDATA section.",
|
|
1244
|
+
[7]: "Unexpected EOF in comment.",
|
|
1245
|
+
[8]: "Unexpected EOF in script.",
|
|
1246
|
+
[9]: "Unexpected EOF in tag.",
|
|
1247
|
+
[10]: "Incorrectly closed comment.",
|
|
1248
|
+
[11]: "Incorrectly opened comment.",
|
|
1249
|
+
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
1250
|
+
[13]: "Attribute value was expected.",
|
|
1251
|
+
[14]: "End tag name was expected.",
|
|
1252
|
+
[15]: "Whitespace was expected.",
|
|
1253
|
+
[16]: "Unexpected '<!--' in comment.",
|
|
1254
|
+
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
1255
|
+
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
1256
|
+
[19]: "Attribute name cannot start with '='.",
|
|
1257
|
+
[21]: "'<?' is allowed only in XML context.",
|
|
1258
|
+
[20]: `Unexpected null character.`,
|
|
1259
|
+
[22]: "Illegal '/' in tags.",
|
|
1260
|
+
// Vue-specific parse errors
|
|
1261
|
+
[23]: "Invalid end tag.",
|
|
1262
|
+
[24]: "Element is missing end tag.",
|
|
1263
|
+
[25]: "Interpolation end sign was not found.",
|
|
1264
|
+
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
1265
|
+
[26]: "Legal directive name was expected.",
|
|
1266
|
+
// transform errors
|
|
1267
|
+
[28]: `v-if/v-else-if is missing expression.`,
|
|
1268
|
+
[29]: `v-if/else branches must use unique keys.`,
|
|
1269
|
+
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
1270
|
+
[31]: `v-for is missing expression.`,
|
|
1271
|
+
[32]: `v-for has invalid expression.`,
|
|
1272
|
+
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
1273
|
+
[34]: `v-bind is missing expression.`,
|
|
1274
|
+
[35]: `v-on is missing expression.`,
|
|
1275
|
+
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
1276
|
+
[37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
|
|
1277
|
+
[38]: `Duplicate slot names found. `,
|
|
1278
|
+
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
1279
|
+
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
1280
|
+
[41]: `v-model is missing expression.`,
|
|
1281
|
+
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
1282
|
+
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
1283
|
+
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
1284
|
+
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
1285
|
+
[45]: `Error parsing JavaScript expression: `,
|
|
1286
|
+
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
1287
|
+
// generic errors
|
|
1288
|
+
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
1289
|
+
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
1290
|
+
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
1291
|
+
[50]: `"scopeId" option is only supported in module mode.`,
|
|
1292
|
+
// deprecations
|
|
1293
|
+
[51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
|
|
1294
|
+
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
1295
|
+
// just to fulfill types
|
|
1296
|
+
[53]: ``
|
|
1297
|
+
};
|
|
1298
|
+
|
|
363
1299
|
const isStaticExp = (p) => p.type === 4 && p.isStatic;
|
|
364
|
-
const isBuiltInType = (tag, expected) => tag === expected || tag === shared.hyphenate(expected);
|
|
365
1300
|
function isCoreComponent(tag) {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
1301
|
+
switch (tag) {
|
|
1302
|
+
case "Teleport":
|
|
1303
|
+
case "teleport":
|
|
1304
|
+
return TELEPORT;
|
|
1305
|
+
case "Suspense":
|
|
1306
|
+
case "suspense":
|
|
1307
|
+
return SUSPENSE;
|
|
1308
|
+
case "KeepAlive":
|
|
1309
|
+
case "keep-alive":
|
|
1310
|
+
return KEEP_ALIVE;
|
|
1311
|
+
case "BaseTransition":
|
|
1312
|
+
case "base-transition":
|
|
1313
|
+
return BASE_TRANSITION;
|
|
374
1314
|
}
|
|
375
1315
|
}
|
|
376
1316
|
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
@@ -454,25 +1394,13 @@ const isMemberExpressionNode = (path, context) => {
|
|
|
454
1394
|
}
|
|
455
1395
|
};
|
|
456
1396
|
const isMemberExpression = isMemberExpressionNode;
|
|
457
|
-
function getInnerRange(loc, offset, length) {
|
|
458
|
-
const source = loc.source.slice(offset, offset + length);
|
|
459
|
-
const newLoc = {
|
|
460
|
-
source,
|
|
461
|
-
start: advancePositionWithClone(loc.start, loc.source, offset),
|
|
462
|
-
end: loc.end
|
|
463
|
-
};
|
|
464
|
-
if (length != null) {
|
|
465
|
-
newLoc.end = advancePositionWithClone(
|
|
466
|
-
loc.start,
|
|
467
|
-
loc.source,
|
|
468
|
-
offset + length
|
|
469
|
-
);
|
|
470
|
-
}
|
|
471
|
-
return newLoc;
|
|
472
|
-
}
|
|
473
1397
|
function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
|
|
474
1398
|
return advancePositionWithMutation(
|
|
475
|
-
|
|
1399
|
+
{
|
|
1400
|
+
offset: pos.offset,
|
|
1401
|
+
line: pos.line,
|
|
1402
|
+
column: pos.column
|
|
1403
|
+
},
|
|
476
1404
|
source,
|
|
477
1405
|
numberOfCharacters
|
|
478
1406
|
);
|
|
@@ -673,471 +1601,547 @@ function getMemoedVNodeCall(node) {
|
|
|
673
1601
|
return node;
|
|
674
1602
|
}
|
|
675
1603
|
}
|
|
1604
|
+
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
676
1605
|
|
|
677
|
-
const deprecationData = {
|
|
678
|
-
["COMPILER_IS_ON_ELEMENT"]: {
|
|
679
|
-
message: `Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".`,
|
|
680
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
|
|
681
|
-
},
|
|
682
|
-
["COMPILER_V_BIND_SYNC"]: {
|
|
683
|
-
message: (key) => `.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${key}.sync\` should be changed to \`v-model:${key}\`.`,
|
|
684
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
|
|
685
|
-
},
|
|
686
|
-
["COMPILER_V_BIND_PROP"]: {
|
|
687
|
-
message: `.prop modifier for v-bind has been removed and no longer necessary. Vue 3 will automatically set a binding as DOM property when appropriate.`
|
|
688
|
-
},
|
|
689
|
-
["COMPILER_V_BIND_OBJECT_ORDER"]: {
|
|
690
|
-
message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.`,
|
|
691
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
|
|
692
|
-
},
|
|
693
|
-
["COMPILER_V_ON_NATIVE"]: {
|
|
694
|
-
message: `.native modifier for v-on has been removed as is no longer necessary.`,
|
|
695
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
|
|
696
|
-
},
|
|
697
|
-
["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
|
|
698
|
-
message: `v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.`,
|
|
699
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
|
|
700
|
-
},
|
|
701
|
-
["COMPILER_NATIVE_TEMPLATE"]: {
|
|
702
|
-
message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
|
|
703
|
-
},
|
|
704
|
-
["COMPILER_INLINE_TEMPLATE"]: {
|
|
705
|
-
message: `"inline-template" has been removed in Vue 3.`,
|
|
706
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
|
|
707
|
-
},
|
|
708
|
-
["COMPILER_FILTER"]: {
|
|
709
|
-
message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`,
|
|
710
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
|
|
711
|
-
}
|
|
712
|
-
};
|
|
713
|
-
function getCompatValue(key, context) {
|
|
714
|
-
const config = context.options ? context.options.compatConfig : context.compatConfig;
|
|
715
|
-
const value = config && config[key];
|
|
716
|
-
if (key === "MODE") {
|
|
717
|
-
return value || 3;
|
|
718
|
-
} else {
|
|
719
|
-
return value;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
function isCompatEnabled(key, context) {
|
|
723
|
-
const mode = getCompatValue("MODE", context);
|
|
724
|
-
const value = getCompatValue(key, context);
|
|
725
|
-
return mode === 3 ? value === true : value !== false;
|
|
726
|
-
}
|
|
727
|
-
function checkCompatEnabled(key, context, loc, ...args) {
|
|
728
|
-
const enabled = isCompatEnabled(key, context);
|
|
729
|
-
if (enabled) {
|
|
730
|
-
warnDeprecation(key, context, loc, ...args);
|
|
731
|
-
}
|
|
732
|
-
return enabled;
|
|
733
|
-
}
|
|
734
|
-
function warnDeprecation(key, context, loc, ...args) {
|
|
735
|
-
const val = getCompatValue(key, context);
|
|
736
|
-
if (val === "suppress-warning") {
|
|
737
|
-
return;
|
|
738
|
-
}
|
|
739
|
-
const { message, link } = deprecationData[key];
|
|
740
|
-
const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
|
|
741
|
-
Details: ${link}` : ``}`;
|
|
742
|
-
const err = new SyntaxError(msg);
|
|
743
|
-
err.code = key;
|
|
744
|
-
if (loc)
|
|
745
|
-
err.loc = loc;
|
|
746
|
-
context.onWarn(err);
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
const decodeRE = /&(gt|lt|amp|apos|quot);/g;
|
|
750
|
-
const decodeMap = {
|
|
751
|
-
gt: ">",
|
|
752
|
-
lt: "<",
|
|
753
|
-
amp: "&",
|
|
754
|
-
apos: "'",
|
|
755
|
-
quot: '"'
|
|
756
|
-
};
|
|
757
1606
|
const defaultParserOptions = {
|
|
1607
|
+
parseMode: "base",
|
|
1608
|
+
ns: 0,
|
|
758
1609
|
delimiters: [`{{`, `}}`],
|
|
759
1610
|
getNamespace: () => 0,
|
|
760
|
-
getTextMode: () => 0,
|
|
761
1611
|
isVoidTag: shared.NO,
|
|
762
1612
|
isPreTag: shared.NO,
|
|
763
1613
|
isCustomElement: shared.NO,
|
|
764
|
-
decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
|
|
765
1614
|
onError: defaultOnError,
|
|
766
1615
|
onWarn: defaultOnWarn,
|
|
767
1616
|
comments: true
|
|
768
1617
|
};
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
let
|
|
802
|
-
if (
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
1618
|
+
let currentOptions = defaultParserOptions;
|
|
1619
|
+
let currentRoot = null;
|
|
1620
|
+
let currentInput = "";
|
|
1621
|
+
let currentOpenTag = null;
|
|
1622
|
+
let currentProp = null;
|
|
1623
|
+
let currentAttrValue = "";
|
|
1624
|
+
let currentAttrStartIndex = -1;
|
|
1625
|
+
let currentAttrEndIndex = -1;
|
|
1626
|
+
let inPre = 0;
|
|
1627
|
+
let inVPre = false;
|
|
1628
|
+
let currentVPreBoundary = null;
|
|
1629
|
+
const stack = [];
|
|
1630
|
+
const tokenizer = new Tokenizer(stack, {
|
|
1631
|
+
onerr: emitError,
|
|
1632
|
+
ontext(start, end) {
|
|
1633
|
+
onText(getSlice(start, end), start, end);
|
|
1634
|
+
},
|
|
1635
|
+
ontextentity(char, start, end) {
|
|
1636
|
+
onText(char, start, end);
|
|
1637
|
+
},
|
|
1638
|
+
oninterpolation(start, end) {
|
|
1639
|
+
if (inVPre) {
|
|
1640
|
+
return onText(getSlice(start, end), start, end);
|
|
1641
|
+
}
|
|
1642
|
+
let innerStart = start + tokenizer.delimiterOpen.length;
|
|
1643
|
+
let innerEnd = end - tokenizer.delimiterClose.length;
|
|
1644
|
+
while (isWhitespace(currentInput.charCodeAt(innerStart))) {
|
|
1645
|
+
innerStart++;
|
|
1646
|
+
}
|
|
1647
|
+
while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
|
|
1648
|
+
innerEnd--;
|
|
1649
|
+
}
|
|
1650
|
+
let exp = getSlice(innerStart, innerEnd);
|
|
1651
|
+
if (exp.includes("&")) {
|
|
1652
|
+
{
|
|
1653
|
+
exp = decode_js.decodeHTML(exp);
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
addNode({
|
|
1657
|
+
type: 5,
|
|
1658
|
+
content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
|
|
1659
|
+
loc: getLoc(start, end)
|
|
1660
|
+
});
|
|
1661
|
+
},
|
|
1662
|
+
onopentagname(start, end) {
|
|
1663
|
+
const name = getSlice(start, end);
|
|
1664
|
+
currentOpenTag = {
|
|
1665
|
+
type: 1,
|
|
1666
|
+
tag: name,
|
|
1667
|
+
ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
|
|
1668
|
+
tagType: 0,
|
|
1669
|
+
// will be refined on tag close
|
|
1670
|
+
props: [],
|
|
1671
|
+
children: [],
|
|
1672
|
+
loc: getLoc(start - 1, end),
|
|
1673
|
+
codegenNode: void 0
|
|
1674
|
+
};
|
|
1675
|
+
if (tokenizer.inSFCRoot) {
|
|
1676
|
+
currentOpenTag.innerLoc = getLoc(
|
|
1677
|
+
end + fastForward(end) + 1,
|
|
1678
|
+
end
|
|
1679
|
+
);
|
|
1680
|
+
}
|
|
1681
|
+
},
|
|
1682
|
+
onopentagend(end) {
|
|
1683
|
+
endOpenTag(end);
|
|
1684
|
+
},
|
|
1685
|
+
onclosetag(start, end) {
|
|
1686
|
+
const name = getSlice(start, end);
|
|
1687
|
+
if (!currentOptions.isVoidTag(name)) {
|
|
1688
|
+
let found = false;
|
|
1689
|
+
for (let i = 0; i < stack.length; i++) {
|
|
1690
|
+
const e = stack[i];
|
|
1691
|
+
if (e.tag.toLowerCase() === name.toLowerCase()) {
|
|
1692
|
+
found = true;
|
|
1693
|
+
if (i > 0) {
|
|
1694
|
+
emitError(24, stack[0].loc.start.offset);
|
|
823
1695
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
} else if (s[2] === ">") {
|
|
828
|
-
emitError(context, 14, 2);
|
|
829
|
-
advanceBy(context, 3);
|
|
830
|
-
continue;
|
|
831
|
-
} else if (/[a-z]/i.test(s[2])) {
|
|
832
|
-
emitError(context, 23);
|
|
833
|
-
parseTag(context, 1 /* End */, parent);
|
|
834
|
-
continue;
|
|
835
|
-
} else {
|
|
836
|
-
emitError(
|
|
837
|
-
context,
|
|
838
|
-
12,
|
|
839
|
-
2
|
|
840
|
-
);
|
|
841
|
-
node = parseBogusComment(context);
|
|
1696
|
+
for (let j = 0; j <= i; j++) {
|
|
1697
|
+
const el = stack.shift();
|
|
1698
|
+
onCloseTag(el, end, j < i);
|
|
842
1699
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
1700
|
+
break;
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
if (!found) {
|
|
1704
|
+
emitError(23, backTrack(start, 60));
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
},
|
|
1708
|
+
onselfclosingtag(end) {
|
|
1709
|
+
var _a;
|
|
1710
|
+
const name = currentOpenTag.tag;
|
|
1711
|
+
currentOpenTag.isSelfClosing = true;
|
|
1712
|
+
endOpenTag(end);
|
|
1713
|
+
if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
|
|
1714
|
+
onCloseTag(stack.shift(), end);
|
|
1715
|
+
}
|
|
1716
|
+
},
|
|
1717
|
+
onattribname(start, end) {
|
|
1718
|
+
currentProp = {
|
|
1719
|
+
type: 6,
|
|
1720
|
+
name: getSlice(start, end),
|
|
1721
|
+
nameLoc: getLoc(start, end),
|
|
1722
|
+
value: void 0,
|
|
1723
|
+
loc: getLoc(start)
|
|
1724
|
+
};
|
|
1725
|
+
},
|
|
1726
|
+
ondirname(start, end) {
|
|
1727
|
+
const raw = getSlice(start, end);
|
|
1728
|
+
const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
|
|
1729
|
+
if (!inVPre && name === "") {
|
|
1730
|
+
emitError(26, start);
|
|
1731
|
+
}
|
|
1732
|
+
if (inVPre || name === "") {
|
|
1733
|
+
currentProp = {
|
|
1734
|
+
type: 6,
|
|
1735
|
+
name: raw,
|
|
1736
|
+
nameLoc: getLoc(start, end),
|
|
1737
|
+
value: void 0,
|
|
1738
|
+
loc: getLoc(start)
|
|
1739
|
+
};
|
|
1740
|
+
} else {
|
|
1741
|
+
currentProp = {
|
|
1742
|
+
type: 7,
|
|
1743
|
+
name,
|
|
1744
|
+
rawName: raw,
|
|
1745
|
+
exp: void 0,
|
|
1746
|
+
arg: void 0,
|
|
1747
|
+
modifiers: raw === "." ? ["prop"] : [],
|
|
1748
|
+
loc: getLoc(start)
|
|
1749
|
+
};
|
|
1750
|
+
if (name === "pre") {
|
|
1751
|
+
inVPre = true;
|
|
1752
|
+
currentVPreBoundary = currentOpenTag;
|
|
1753
|
+
const props = currentOpenTag.props;
|
|
1754
|
+
for (let i = 0; i < props.length; i++) {
|
|
1755
|
+
if (props[i].type === 7) {
|
|
1756
|
+
props[i] = dirToAttr(props[i]);
|
|
857
1757
|
}
|
|
858
|
-
} else if (s[1] === "?") {
|
|
859
|
-
emitError(
|
|
860
|
-
context,
|
|
861
|
-
21,
|
|
862
|
-
1
|
|
863
|
-
);
|
|
864
|
-
node = parseBogusComment(context);
|
|
865
|
-
} else {
|
|
866
|
-
emitError(context, 12, 1);
|
|
867
1758
|
}
|
|
868
1759
|
}
|
|
869
1760
|
}
|
|
870
|
-
|
|
871
|
-
|
|
1761
|
+
},
|
|
1762
|
+
ondirarg(start, end) {
|
|
1763
|
+
const arg = getSlice(start, end);
|
|
1764
|
+
if (inVPre) {
|
|
1765
|
+
currentProp.name += arg;
|
|
1766
|
+
setLocEnd(currentProp.nameLoc, end);
|
|
1767
|
+
} else {
|
|
1768
|
+
const isStatic = arg[0] !== `[`;
|
|
1769
|
+
currentProp.arg = createSimpleExpression(
|
|
1770
|
+
isStatic ? arg : arg.slice(1, -1),
|
|
1771
|
+
isStatic,
|
|
1772
|
+
getLoc(start, end),
|
|
1773
|
+
isStatic ? 3 : 0
|
|
1774
|
+
);
|
|
872
1775
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1776
|
+
},
|
|
1777
|
+
ondirmodifier(start, end) {
|
|
1778
|
+
const mod = getSlice(start, end);
|
|
1779
|
+
if (inVPre) {
|
|
1780
|
+
currentProp.name += "." + mod;
|
|
1781
|
+
setLocEnd(currentProp.nameLoc, end);
|
|
1782
|
+
} else if (currentProp.name === "slot") {
|
|
1783
|
+
const arg = currentProp.arg;
|
|
1784
|
+
if (arg) {
|
|
1785
|
+
arg.content += "." + mod;
|
|
1786
|
+
setLocEnd(arg.loc, end);
|
|
876
1787
|
}
|
|
877
1788
|
} else {
|
|
878
|
-
|
|
1789
|
+
currentProp.modifiers.push(mod);
|
|
879
1790
|
}
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
1791
|
+
},
|
|
1792
|
+
onattribdata(start, end) {
|
|
1793
|
+
currentAttrValue += getSlice(start, end);
|
|
1794
|
+
if (currentAttrStartIndex < 0)
|
|
1795
|
+
currentAttrStartIndex = start;
|
|
1796
|
+
currentAttrEndIndex = end;
|
|
1797
|
+
},
|
|
1798
|
+
onattribentity(char, start, end) {
|
|
1799
|
+
currentAttrValue += char;
|
|
1800
|
+
if (currentAttrStartIndex < 0)
|
|
1801
|
+
currentAttrStartIndex = start;
|
|
1802
|
+
currentAttrEndIndex = end;
|
|
1803
|
+
},
|
|
1804
|
+
onattribnameend(end) {
|
|
1805
|
+
const start = currentProp.loc.start.offset;
|
|
1806
|
+
const name = getSlice(start, end);
|
|
1807
|
+
if (currentProp.type === 7) {
|
|
1808
|
+
currentProp.rawName = name;
|
|
1809
|
+
}
|
|
1810
|
+
if (currentOpenTag.props.some(
|
|
1811
|
+
(p) => (p.type === 7 ? p.rawName : p.name) === name
|
|
1812
|
+
)) {
|
|
1813
|
+
emitError(2, start);
|
|
1814
|
+
}
|
|
1815
|
+
},
|
|
1816
|
+
onattribend(quote, end) {
|
|
1817
|
+
if (currentOpenTag && currentProp) {
|
|
1818
|
+
setLocEnd(currentProp.loc, end);
|
|
1819
|
+
if (quote !== 0) {
|
|
1820
|
+
if (currentProp.type === 6) {
|
|
1821
|
+
if (currentProp.name === "class") {
|
|
1822
|
+
currentAttrValue = condense(currentAttrValue).trim();
|
|
1823
|
+
}
|
|
1824
|
+
if (quote === 1 && !currentAttrValue) {
|
|
1825
|
+
emitError(13, end);
|
|
1826
|
+
}
|
|
1827
|
+
currentProp.value = {
|
|
1828
|
+
type: 2,
|
|
1829
|
+
content: currentAttrValue,
|
|
1830
|
+
loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
|
|
1831
|
+
};
|
|
1832
|
+
if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
|
|
1833
|
+
tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
|
|
899
1834
|
}
|
|
900
1835
|
} else {
|
|
901
|
-
|
|
1836
|
+
currentProp.exp = createSimpleExpression(
|
|
1837
|
+
currentAttrValue,
|
|
1838
|
+
false,
|
|
1839
|
+
getLoc(currentAttrStartIndex, currentAttrEndIndex)
|
|
1840
|
+
);
|
|
1841
|
+
if (currentProp.name === "for") {
|
|
1842
|
+
currentProp.forParseResult = parseForExpression(currentProp.exp);
|
|
1843
|
+
}
|
|
1844
|
+
let syncIndex = -1;
|
|
1845
|
+
if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
|
|
1846
|
+
"COMPILER_V_BIND_SYNC",
|
|
1847
|
+
currentOptions,
|
|
1848
|
+
currentProp.loc,
|
|
1849
|
+
currentProp.rawName
|
|
1850
|
+
)) {
|
|
1851
|
+
currentProp.name = "model";
|
|
1852
|
+
currentProp.modifiers.splice(syncIndex, 1);
|
|
1853
|
+
}
|
|
902
1854
|
}
|
|
903
|
-
} else if (node.type === 3 && !context.options.comments) {
|
|
904
|
-
removedWhitespace = true;
|
|
905
|
-
nodes[i] = null;
|
|
906
1855
|
}
|
|
1856
|
+
if (currentProp.type !== 7 || currentProp.name !== "pre") {
|
|
1857
|
+
currentOpenTag.props.push(currentProp);
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
currentAttrValue = "";
|
|
1861
|
+
currentAttrStartIndex = currentAttrEndIndex = -1;
|
|
1862
|
+
},
|
|
1863
|
+
oncomment(start, end) {
|
|
1864
|
+
if (currentOptions.comments) {
|
|
1865
|
+
addNode({
|
|
1866
|
+
type: 3,
|
|
1867
|
+
content: getSlice(start, end),
|
|
1868
|
+
loc: getLoc(start - 4, end + 3)
|
|
1869
|
+
});
|
|
907
1870
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1871
|
+
},
|
|
1872
|
+
onend() {
|
|
1873
|
+
const end = currentInput.length;
|
|
1874
|
+
if (tokenizer.state !== 1) {
|
|
1875
|
+
switch (tokenizer.state) {
|
|
1876
|
+
case 5:
|
|
1877
|
+
case 8:
|
|
1878
|
+
emitError(5, end);
|
|
1879
|
+
break;
|
|
1880
|
+
case 3:
|
|
1881
|
+
case 4:
|
|
1882
|
+
emitError(
|
|
1883
|
+
25,
|
|
1884
|
+
tokenizer.sectionStart
|
|
1885
|
+
);
|
|
1886
|
+
break;
|
|
1887
|
+
case 28:
|
|
1888
|
+
if (tokenizer.currentSequence === Sequences.CdataEnd) {
|
|
1889
|
+
emitError(6, end);
|
|
1890
|
+
} else {
|
|
1891
|
+
emitError(7, end);
|
|
1892
|
+
}
|
|
1893
|
+
break;
|
|
1894
|
+
case 6:
|
|
1895
|
+
case 7:
|
|
1896
|
+
case 9:
|
|
1897
|
+
case 11:
|
|
1898
|
+
case 12:
|
|
1899
|
+
case 13:
|
|
1900
|
+
case 14:
|
|
1901
|
+
case 15:
|
|
1902
|
+
case 16:
|
|
1903
|
+
case 17:
|
|
1904
|
+
case 18:
|
|
1905
|
+
case 19:
|
|
1906
|
+
case 20:
|
|
1907
|
+
case 21:
|
|
1908
|
+
emitError(9, end);
|
|
1909
|
+
break;
|
|
912
1910
|
}
|
|
913
1911
|
}
|
|
1912
|
+
for (let index = 0; index < stack.length; index++) {
|
|
1913
|
+
onCloseTag(stack[index], end - 1);
|
|
1914
|
+
emitError(24, stack[index].loc.start.offset);
|
|
1915
|
+
}
|
|
1916
|
+
},
|
|
1917
|
+
oncdata(start, end) {
|
|
1918
|
+
if (stack[0].ns !== 0) {
|
|
1919
|
+
onText(getSlice(start, end), start, end);
|
|
1920
|
+
} else {
|
|
1921
|
+
emitError(1, start - 9);
|
|
1922
|
+
}
|
|
1923
|
+
},
|
|
1924
|
+
onprocessinginstruction(start) {
|
|
1925
|
+
if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
1926
|
+
emitError(
|
|
1927
|
+
21,
|
|
1928
|
+
start - 1
|
|
1929
|
+
);
|
|
1930
|
+
}
|
|
914
1931
|
}
|
|
915
|
-
|
|
1932
|
+
});
|
|
1933
|
+
const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
|
1934
|
+
const stripParensRE = /^\(|\)$/g;
|
|
1935
|
+
function parseForExpression(input) {
|
|
1936
|
+
const loc = input.loc;
|
|
1937
|
+
const exp = input.content;
|
|
1938
|
+
const inMatch = exp.match(forAliasRE);
|
|
1939
|
+
if (!inMatch)
|
|
1940
|
+
return;
|
|
1941
|
+
const [, LHS, RHS] = inMatch;
|
|
1942
|
+
const createAliasExpression = (content, offset) => {
|
|
1943
|
+
const start = loc.start.offset + offset;
|
|
1944
|
+
const end = start + content.length;
|
|
1945
|
+
return createSimpleExpression(content, false, getLoc(start, end));
|
|
1946
|
+
};
|
|
1947
|
+
const result = {
|
|
1948
|
+
source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
|
|
1949
|
+
value: void 0,
|
|
1950
|
+
key: void 0,
|
|
1951
|
+
index: void 0,
|
|
1952
|
+
finalized: false
|
|
1953
|
+
};
|
|
1954
|
+
let valueContent = LHS.trim().replace(stripParensRE, "").trim();
|
|
1955
|
+
const trimmedOffset = LHS.indexOf(valueContent);
|
|
1956
|
+
const iteratorMatch = valueContent.match(forIteratorRE);
|
|
1957
|
+
if (iteratorMatch) {
|
|
1958
|
+
valueContent = valueContent.replace(forIteratorRE, "").trim();
|
|
1959
|
+
const keyContent = iteratorMatch[1].trim();
|
|
1960
|
+
let keyOffset;
|
|
1961
|
+
if (keyContent) {
|
|
1962
|
+
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
1963
|
+
result.key = createAliasExpression(keyContent, keyOffset);
|
|
1964
|
+
}
|
|
1965
|
+
if (iteratorMatch[2]) {
|
|
1966
|
+
const indexContent = iteratorMatch[2].trim();
|
|
1967
|
+
if (indexContent) {
|
|
1968
|
+
result.index = createAliasExpression(
|
|
1969
|
+
indexContent,
|
|
1970
|
+
exp.indexOf(
|
|
1971
|
+
indexContent,
|
|
1972
|
+
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
1973
|
+
)
|
|
1974
|
+
);
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
if (valueContent) {
|
|
1979
|
+
result.value = createAliasExpression(valueContent, trimmedOffset);
|
|
1980
|
+
}
|
|
1981
|
+
return result;
|
|
916
1982
|
}
|
|
917
|
-
function
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1983
|
+
function getSlice(start, end) {
|
|
1984
|
+
return currentInput.slice(start, end);
|
|
1985
|
+
}
|
|
1986
|
+
function endOpenTag(end) {
|
|
1987
|
+
addNode(currentOpenTag);
|
|
1988
|
+
const { tag, ns } = currentOpenTag;
|
|
1989
|
+
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
1990
|
+
inPre++;
|
|
1991
|
+
}
|
|
1992
|
+
if (currentOptions.isVoidTag(tag)) {
|
|
1993
|
+
onCloseTag(currentOpenTag, end);
|
|
1994
|
+
} else {
|
|
1995
|
+
stack.unshift(currentOpenTag);
|
|
1996
|
+
if (ns === 1 || ns === 2) {
|
|
1997
|
+
tokenizer.inXML = true;
|
|
925
1998
|
}
|
|
926
1999
|
}
|
|
927
|
-
|
|
2000
|
+
currentOpenTag = null;
|
|
928
2001
|
}
|
|
929
|
-
function
|
|
930
|
-
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
|
|
2002
|
+
function onText(content, start, end) {
|
|
2003
|
+
const parent = stack[0] || currentRoot;
|
|
2004
|
+
const lastNode = parent.children[parent.children.length - 1];
|
|
2005
|
+
if ((lastNode == null ? void 0 : lastNode.type) === 2) {
|
|
2006
|
+
lastNode.content += content;
|
|
2007
|
+
setLocEnd(lastNode.loc, end);
|
|
934
2008
|
} else {
|
|
935
|
-
|
|
2009
|
+
parent.children.push({
|
|
2010
|
+
type: 2,
|
|
2011
|
+
content,
|
|
2012
|
+
loc: getLoc(start, end)
|
|
2013
|
+
});
|
|
936
2014
|
}
|
|
937
|
-
return nodes;
|
|
938
2015
|
}
|
|
939
|
-
function
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
const match = /--(\!)?>/.exec(context.source);
|
|
943
|
-
if (!match) {
|
|
944
|
-
content = context.source.slice(4);
|
|
945
|
-
advanceBy(context, context.source.length);
|
|
946
|
-
emitError(context, 7);
|
|
2016
|
+
function onCloseTag(el, end, isImplied = false) {
|
|
2017
|
+
if (isImplied) {
|
|
2018
|
+
setLocEnd(el.loc, backTrack(end, 60));
|
|
947
2019
|
} else {
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
if (
|
|
952
|
-
|
|
2020
|
+
setLocEnd(el.loc, end + fastForward(end) + 1);
|
|
2021
|
+
}
|
|
2022
|
+
if (tokenizer.inSFCRoot) {
|
|
2023
|
+
if (el.children.length) {
|
|
2024
|
+
el.innerLoc.end = shared.extend({}, el.children[el.children.length - 1].loc.end);
|
|
2025
|
+
} else {
|
|
2026
|
+
el.innerLoc.end = shared.extend({}, el.innerLoc.start);
|
|
953
2027
|
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
2028
|
+
el.innerLoc.source = getSlice(
|
|
2029
|
+
el.innerLoc.start.offset,
|
|
2030
|
+
el.innerLoc.end.offset
|
|
2031
|
+
);
|
|
2032
|
+
}
|
|
2033
|
+
const { tag, ns } = el;
|
|
2034
|
+
if (!inVPre) {
|
|
2035
|
+
if (tag === "slot") {
|
|
2036
|
+
el.tagType = 2;
|
|
2037
|
+
} else if (isFragmentTemplate(el)) {
|
|
2038
|
+
el.tagType = 3;
|
|
2039
|
+
} else if (isComponent(el)) {
|
|
2040
|
+
el.tagType = 1;
|
|
963
2041
|
}
|
|
964
|
-
advanceBy(context, match.index + match[0].length - prevIndex + 1);
|
|
965
2042
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
content = context.source.slice(contentStart);
|
|
979
|
-
advanceBy(context, context.source.length);
|
|
980
|
-
} else {
|
|
981
|
-
content = context.source.slice(contentStart, closeIndex);
|
|
982
|
-
advanceBy(context, closeIndex + 1);
|
|
2043
|
+
if (!tokenizer.inRCDATA) {
|
|
2044
|
+
el.children = condenseWhitespace(el.children, el.tag);
|
|
2045
|
+
}
|
|
2046
|
+
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
2047
|
+
inPre--;
|
|
2048
|
+
}
|
|
2049
|
+
if (currentVPreBoundary === el) {
|
|
2050
|
+
inVPre = false;
|
|
2051
|
+
currentVPreBoundary = null;
|
|
2052
|
+
}
|
|
2053
|
+
if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
2054
|
+
tokenizer.inXML = false;
|
|
983
2055
|
}
|
|
984
|
-
return {
|
|
985
|
-
type: 3,
|
|
986
|
-
content,
|
|
987
|
-
loc: getSelection(context, start)
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
function parseElement(context, ancestors) {
|
|
991
|
-
const wasInPre = context.inPre;
|
|
992
|
-
const wasInVPre = context.inVPre;
|
|
993
|
-
const parent = last(ancestors);
|
|
994
|
-
const element = parseTag(context, 0 /* Start */, parent);
|
|
995
|
-
const isPreBoundary = context.inPre && !wasInPre;
|
|
996
|
-
const isVPreBoundary = context.inVPre && !wasInVPre;
|
|
997
|
-
if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
|
|
998
|
-
if (isPreBoundary) {
|
|
999
|
-
context.inPre = false;
|
|
1000
|
-
}
|
|
1001
|
-
if (isVPreBoundary) {
|
|
1002
|
-
context.inVPre = false;
|
|
1003
|
-
}
|
|
1004
|
-
return element;
|
|
1005
|
-
}
|
|
1006
|
-
ancestors.push(element);
|
|
1007
|
-
const mode = context.options.getTextMode(element, parent);
|
|
1008
|
-
const children = parseChildren(context, mode, ancestors);
|
|
1009
|
-
ancestors.pop();
|
|
1010
2056
|
{
|
|
1011
|
-
const
|
|
2057
|
+
const props = el.props;
|
|
2058
|
+
if (isCompatEnabled(
|
|
2059
|
+
"COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
2060
|
+
currentOptions
|
|
2061
|
+
)) {
|
|
2062
|
+
let hasIf = false;
|
|
2063
|
+
let hasFor = false;
|
|
2064
|
+
for (let i = 0; i < props.length; i++) {
|
|
2065
|
+
const p = props[i];
|
|
2066
|
+
if (p.type === 7) {
|
|
2067
|
+
if (p.name === "if") {
|
|
2068
|
+
hasIf = true;
|
|
2069
|
+
} else if (p.name === "for") {
|
|
2070
|
+
hasFor = true;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
if (hasIf && hasFor) {
|
|
2074
|
+
warnDeprecation(
|
|
2075
|
+
"COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
2076
|
+
currentOptions,
|
|
2077
|
+
el.loc
|
|
2078
|
+
);
|
|
2079
|
+
break;
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
if (isCompatEnabled(
|
|
2084
|
+
"COMPILER_NATIVE_TEMPLATE",
|
|
2085
|
+
currentOptions
|
|
2086
|
+
) && el.tag === "template" && !isFragmentTemplate(el)) {
|
|
2087
|
+
warnDeprecation(
|
|
2088
|
+
"COMPILER_NATIVE_TEMPLATE",
|
|
2089
|
+
currentOptions,
|
|
2090
|
+
el.loc
|
|
2091
|
+
);
|
|
2092
|
+
const parent = stack[0] || currentRoot;
|
|
2093
|
+
const index = parent.children.indexOf(el);
|
|
2094
|
+
parent.children.splice(index, 1, ...el.children);
|
|
2095
|
+
}
|
|
2096
|
+
const inlineTemplateProp = props.find(
|
|
1012
2097
|
(p) => p.type === 6 && p.name === "inline-template"
|
|
1013
2098
|
);
|
|
1014
2099
|
if (inlineTemplateProp && checkCompatEnabled(
|
|
1015
2100
|
"COMPILER_INLINE_TEMPLATE",
|
|
1016
|
-
|
|
2101
|
+
currentOptions,
|
|
1017
2102
|
inlineTemplateProp.loc
|
|
1018
|
-
)) {
|
|
1019
|
-
const loc = getSelection(context, element.loc.end);
|
|
2103
|
+
) && el.children.length) {
|
|
1020
2104
|
inlineTemplateProp.value = {
|
|
1021
2105
|
type: 2,
|
|
1022
|
-
content:
|
|
1023
|
-
|
|
2106
|
+
content: getSlice(
|
|
2107
|
+
el.children[0].loc.start.offset,
|
|
2108
|
+
el.children[el.children.length - 1].loc.end.offset
|
|
2109
|
+
),
|
|
2110
|
+
loc: inlineTemplateProp.loc
|
|
1024
2111
|
};
|
|
1025
2112
|
}
|
|
1026
2113
|
}
|
|
1027
|
-
element.children = children;
|
|
1028
|
-
if (startsWithEndTagOpen(context.source, element.tag)) {
|
|
1029
|
-
parseTag(context, 1 /* End */, parent);
|
|
1030
|
-
} else {
|
|
1031
|
-
emitError(context, 24, 0, element.loc.start);
|
|
1032
|
-
if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
|
|
1033
|
-
const first = children[0];
|
|
1034
|
-
if (first && startsWith(first.loc.source, "<!--")) {
|
|
1035
|
-
emitError(context, 8);
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
element.loc = getSelection(context, element.loc.start);
|
|
1040
|
-
if (isPreBoundary) {
|
|
1041
|
-
context.inPre = false;
|
|
1042
|
-
}
|
|
1043
|
-
if (isVPreBoundary) {
|
|
1044
|
-
context.inVPre = false;
|
|
1045
|
-
}
|
|
1046
|
-
return element;
|
|
1047
2114
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
)
|
|
1051
|
-
|
|
1052
|
-
const start = getCursor(context);
|
|
1053
|
-
const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
|
|
1054
|
-
const tag = match[1];
|
|
1055
|
-
const ns = context.options.getNamespace(tag, parent);
|
|
1056
|
-
advanceBy(context, match[0].length);
|
|
1057
|
-
advanceSpaces(context);
|
|
1058
|
-
const cursor = getCursor(context);
|
|
1059
|
-
const currentSource = context.source;
|
|
1060
|
-
if (context.options.isPreTag(tag)) {
|
|
1061
|
-
context.inPre = true;
|
|
1062
|
-
}
|
|
1063
|
-
let props = parseAttributes(context, type);
|
|
1064
|
-
if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
|
|
1065
|
-
context.inVPre = true;
|
|
1066
|
-
shared.extend(context, cursor);
|
|
1067
|
-
context.source = currentSource;
|
|
1068
|
-
props = parseAttributes(context, type).filter((p) => p.name !== "v-pre");
|
|
1069
|
-
}
|
|
1070
|
-
let isSelfClosing = false;
|
|
1071
|
-
if (context.source.length === 0) {
|
|
1072
|
-
emitError(context, 9);
|
|
1073
|
-
} else {
|
|
1074
|
-
isSelfClosing = startsWith(context.source, "/>");
|
|
1075
|
-
if (type === 1 /* End */ && isSelfClosing) {
|
|
1076
|
-
emitError(context, 4);
|
|
1077
|
-
}
|
|
1078
|
-
advanceBy(context, isSelfClosing ? 2 : 1);
|
|
2115
|
+
function fastForward(start, c) {
|
|
2116
|
+
let offset = 0;
|
|
2117
|
+
while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
|
|
2118
|
+
offset++;
|
|
1079
2119
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
2120
|
+
return offset;
|
|
2121
|
+
}
|
|
2122
|
+
function backTrack(index, c) {
|
|
2123
|
+
let i = index;
|
|
2124
|
+
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
2125
|
+
i--;
|
|
2126
|
+
return i;
|
|
2127
|
+
}
|
|
2128
|
+
const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
|
|
2129
|
+
function isFragmentTemplate({ tag, props }) {
|
|
2130
|
+
if (tag === "template") {
|
|
1089
2131
|
for (let i = 0; i < props.length; i++) {
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
if (p.name === "if") {
|
|
1093
|
-
hasIf = true;
|
|
1094
|
-
} else if (p.name === "for") {
|
|
1095
|
-
hasFor = true;
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
if (hasIf && hasFor) {
|
|
1099
|
-
warnDeprecation(
|
|
1100
|
-
"COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
1101
|
-
context,
|
|
1102
|
-
getSelection(context, start)
|
|
1103
|
-
);
|
|
1104
|
-
break;
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
let tagType = 0;
|
|
1109
|
-
if (!context.inVPre) {
|
|
1110
|
-
if (tag === "slot") {
|
|
1111
|
-
tagType = 2;
|
|
1112
|
-
} else if (tag === "template") {
|
|
1113
|
-
if (props.some(
|
|
1114
|
-
(p) => p.type === 7 && isSpecialTemplateDirective(p.name)
|
|
1115
|
-
)) {
|
|
1116
|
-
tagType = 3;
|
|
2132
|
+
if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
|
|
2133
|
+
return true;
|
|
1117
2134
|
}
|
|
1118
|
-
} else if (isComponent(tag, props, context)) {
|
|
1119
|
-
tagType = 1;
|
|
1120
2135
|
}
|
|
1121
2136
|
}
|
|
1122
|
-
return
|
|
1123
|
-
type: 1,
|
|
1124
|
-
ns,
|
|
1125
|
-
tag,
|
|
1126
|
-
tagType,
|
|
1127
|
-
props,
|
|
1128
|
-
isSelfClosing,
|
|
1129
|
-
children: [],
|
|
1130
|
-
loc: getSelection(context, start),
|
|
1131
|
-
codegenNode: void 0
|
|
1132
|
-
// to be created during transform phase
|
|
1133
|
-
};
|
|
2137
|
+
return false;
|
|
1134
2138
|
}
|
|
1135
|
-
function isComponent(tag, props
|
|
1136
|
-
|
|
1137
|
-
if (
|
|
2139
|
+
function isComponent({ tag, props }) {
|
|
2140
|
+
var _a;
|
|
2141
|
+
if (currentOptions.isCustomElement(tag)) {
|
|
1138
2142
|
return false;
|
|
1139
2143
|
}
|
|
1140
|
-
if (tag === "component" ||
|
|
2144
|
+
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
|
|
1141
2145
|
return true;
|
|
1142
2146
|
}
|
|
1143
2147
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -1148,374 +2152,179 @@ function isComponent(tag, props, context) {
|
|
|
1148
2152
|
return true;
|
|
1149
2153
|
} else if (checkCompatEnabled(
|
|
1150
2154
|
"COMPILER_IS_ON_ELEMENT",
|
|
1151
|
-
|
|
2155
|
+
currentOptions,
|
|
1152
2156
|
p.loc
|
|
1153
2157
|
)) {
|
|
1154
2158
|
return true;
|
|
1155
2159
|
}
|
|
1156
2160
|
}
|
|
1157
|
-
} else
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
context,
|
|
1165
|
-
p.loc
|
|
1166
|
-
)
|
|
1167
|
-
) {
|
|
1168
|
-
return true;
|
|
1169
|
-
}
|
|
2161
|
+
} else if (// :is on plain element - only treat as component in compat mode
|
|
2162
|
+
p.name === "bind" && isStaticArgOf(p.arg, "is") && checkCompatEnabled(
|
|
2163
|
+
"COMPILER_IS_ON_ELEMENT",
|
|
2164
|
+
currentOptions,
|
|
2165
|
+
p.loc
|
|
2166
|
+
)) {
|
|
2167
|
+
return true;
|
|
1170
2168
|
}
|
|
1171
2169
|
}
|
|
2170
|
+
return false;
|
|
1172
2171
|
}
|
|
1173
|
-
function
|
|
1174
|
-
|
|
1175
|
-
const attributeNames = /* @__PURE__ */ new Set();
|
|
1176
|
-
while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
|
|
1177
|
-
if (startsWith(context.source, "/")) {
|
|
1178
|
-
emitError(context, 22);
|
|
1179
|
-
advanceBy(context, 1);
|
|
1180
|
-
advanceSpaces(context);
|
|
1181
|
-
continue;
|
|
1182
|
-
}
|
|
1183
|
-
if (type === 1 /* End */) {
|
|
1184
|
-
emitError(context, 3);
|
|
1185
|
-
}
|
|
1186
|
-
const attr = parseAttribute(context, attributeNames);
|
|
1187
|
-
if (attr.type === 6 && attr.value && attr.name === "class") {
|
|
1188
|
-
attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
|
|
1189
|
-
}
|
|
1190
|
-
if (type === 0 /* Start */) {
|
|
1191
|
-
props.push(attr);
|
|
1192
|
-
}
|
|
1193
|
-
if (/^[^\t\r\n\f />]/.test(context.source)) {
|
|
1194
|
-
emitError(context, 15);
|
|
1195
|
-
}
|
|
1196
|
-
advanceSpaces(context);
|
|
1197
|
-
}
|
|
1198
|
-
return props;
|
|
2172
|
+
function isUpperCase(c) {
|
|
2173
|
+
return c > 64 && c < 91;
|
|
1199
2174
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
);
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
advanceBy(context, name.length);
|
|
1224
|
-
let value = void 0;
|
|
1225
|
-
if (/^[\t\r\n\f ]*=/.test(context.source)) {
|
|
1226
|
-
advanceSpaces(context);
|
|
1227
|
-
advanceBy(context, 1);
|
|
1228
|
-
advanceSpaces(context);
|
|
1229
|
-
value = parseAttributeValue(context);
|
|
1230
|
-
if (!value) {
|
|
1231
|
-
emitError(context, 13);
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
const loc = getSelection(context, start);
|
|
1235
|
-
if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
|
|
1236
|
-
const match2 = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
|
|
1237
|
-
name
|
|
1238
|
-
);
|
|
1239
|
-
let isPropShorthand = startsWith(name, ".");
|
|
1240
|
-
let dirName = match2[1] || (isPropShorthand || startsWith(name, ":") ? "bind" : startsWith(name, "@") ? "on" : "slot");
|
|
1241
|
-
let arg;
|
|
1242
|
-
if (match2[2]) {
|
|
1243
|
-
const isSlot = dirName === "slot";
|
|
1244
|
-
const startOffset = name.lastIndexOf(
|
|
1245
|
-
match2[2],
|
|
1246
|
-
name.length - (((_a = match2[3]) == null ? void 0 : _a.length) || 0)
|
|
1247
|
-
);
|
|
1248
|
-
const loc2 = getSelection(
|
|
1249
|
-
context,
|
|
1250
|
-
getNewPosition(context, start, startOffset),
|
|
1251
|
-
getNewPosition(
|
|
1252
|
-
context,
|
|
1253
|
-
start,
|
|
1254
|
-
startOffset + match2[2].length + (isSlot && match2[3] || "").length
|
|
1255
|
-
)
|
|
1256
|
-
);
|
|
1257
|
-
let content = match2[2];
|
|
1258
|
-
let isStatic = true;
|
|
1259
|
-
if (content.startsWith("[")) {
|
|
1260
|
-
isStatic = false;
|
|
1261
|
-
if (!content.endsWith("]")) {
|
|
1262
|
-
emitError(
|
|
1263
|
-
context,
|
|
1264
|
-
27
|
|
1265
|
-
);
|
|
1266
|
-
content = content.slice(1);
|
|
1267
|
-
} else {
|
|
1268
|
-
content = content.slice(1, content.length - 1);
|
|
2175
|
+
const windowsNewlineRE = /\r\n/g;
|
|
2176
|
+
function condenseWhitespace(nodes, tag) {
|
|
2177
|
+
var _a, _b;
|
|
2178
|
+
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
2179
|
+
let removedWhitespace = false;
|
|
2180
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
2181
|
+
const node = nodes[i];
|
|
2182
|
+
if (node.type === 2) {
|
|
2183
|
+
if (!inPre) {
|
|
2184
|
+
if (isAllWhitespace(node.content)) {
|
|
2185
|
+
const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
|
|
2186
|
+
const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
|
|
2187
|
+
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
2188
|
+
removedWhitespace = true;
|
|
2189
|
+
nodes[i] = null;
|
|
2190
|
+
} else {
|
|
2191
|
+
node.content = " ";
|
|
2192
|
+
}
|
|
2193
|
+
} else if (shouldCondense) {
|
|
2194
|
+
node.content = condense(node.content);
|
|
1269
2195
|
}
|
|
1270
|
-
} else
|
|
1271
|
-
content
|
|
1272
|
-
}
|
|
1273
|
-
arg = {
|
|
1274
|
-
type: 4,
|
|
1275
|
-
content,
|
|
1276
|
-
isStatic,
|
|
1277
|
-
constType: isStatic ? 3 : 0,
|
|
1278
|
-
loc: loc2
|
|
1279
|
-
};
|
|
1280
|
-
}
|
|
1281
|
-
if (value && value.isQuoted) {
|
|
1282
|
-
const valueLoc = value.loc;
|
|
1283
|
-
valueLoc.start.offset++;
|
|
1284
|
-
valueLoc.start.column++;
|
|
1285
|
-
valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
|
|
1286
|
-
valueLoc.source = valueLoc.source.slice(1, -1);
|
|
1287
|
-
}
|
|
1288
|
-
const modifiers = match2[3] ? match2[3].slice(1).split(".") : [];
|
|
1289
|
-
if (isPropShorthand)
|
|
1290
|
-
modifiers.push("prop");
|
|
1291
|
-
if (dirName === "bind" && arg) {
|
|
1292
|
-
if (modifiers.includes("sync") && checkCompatEnabled(
|
|
1293
|
-
"COMPILER_V_BIND_SYNC",
|
|
1294
|
-
context,
|
|
1295
|
-
loc,
|
|
1296
|
-
arg.loc.source
|
|
1297
|
-
)) {
|
|
1298
|
-
dirName = "model";
|
|
1299
|
-
modifiers.splice(modifiers.indexOf("sync"), 1);
|
|
1300
|
-
}
|
|
1301
|
-
if (modifiers.includes("prop")) {
|
|
1302
|
-
checkCompatEnabled(
|
|
1303
|
-
"COMPILER_V_BIND_PROP",
|
|
1304
|
-
context,
|
|
1305
|
-
loc
|
|
1306
|
-
);
|
|
2196
|
+
} else {
|
|
2197
|
+
node.content = node.content.replace(windowsNewlineRE, "\n");
|
|
1307
2198
|
}
|
|
1308
2199
|
}
|
|
1309
|
-
return {
|
|
1310
|
-
type: 7,
|
|
1311
|
-
name: dirName,
|
|
1312
|
-
exp: value && {
|
|
1313
|
-
type: 4,
|
|
1314
|
-
content: value.content,
|
|
1315
|
-
isStatic: false,
|
|
1316
|
-
// Treat as non-constant by default. This can be potentially set to
|
|
1317
|
-
// other values by `transformExpression` to make it eligible for hoisting.
|
|
1318
|
-
constType: 0,
|
|
1319
|
-
loc: value.loc
|
|
1320
|
-
},
|
|
1321
|
-
arg,
|
|
1322
|
-
modifiers,
|
|
1323
|
-
loc
|
|
1324
|
-
};
|
|
1325
2200
|
}
|
|
1326
|
-
if (
|
|
1327
|
-
|
|
2201
|
+
if (inPre && tag && currentOptions.isPreTag(tag)) {
|
|
2202
|
+
const first = nodes[0];
|
|
2203
|
+
if (first && first.type === 2) {
|
|
2204
|
+
first.content = first.content.replace(/^\r?\n/, "");
|
|
2205
|
+
}
|
|
1328
2206
|
}
|
|
1329
|
-
return
|
|
1330
|
-
type: 6,
|
|
1331
|
-
name,
|
|
1332
|
-
value: value && {
|
|
1333
|
-
type: 2,
|
|
1334
|
-
content: value.content,
|
|
1335
|
-
loc: value.loc
|
|
1336
|
-
},
|
|
1337
|
-
loc
|
|
1338
|
-
};
|
|
2207
|
+
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
1339
2208
|
}
|
|
1340
|
-
function
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
const isQuoted = quote === `"` || quote === `'`;
|
|
1345
|
-
if (isQuoted) {
|
|
1346
|
-
advanceBy(context, 1);
|
|
1347
|
-
const endIndex = context.source.indexOf(quote);
|
|
1348
|
-
if (endIndex === -1) {
|
|
1349
|
-
content = parseTextData(
|
|
1350
|
-
context,
|
|
1351
|
-
context.source.length,
|
|
1352
|
-
4
|
|
1353
|
-
);
|
|
1354
|
-
} else {
|
|
1355
|
-
content = parseTextData(context, endIndex, 4);
|
|
1356
|
-
advanceBy(context, 1);
|
|
1357
|
-
}
|
|
1358
|
-
} else {
|
|
1359
|
-
const match = /^[^\t\r\n\f >]+/.exec(context.source);
|
|
1360
|
-
if (!match) {
|
|
1361
|
-
return void 0;
|
|
1362
|
-
}
|
|
1363
|
-
const unexpectedChars = /["'<=`]/g;
|
|
1364
|
-
let m;
|
|
1365
|
-
while (m = unexpectedChars.exec(match[0])) {
|
|
1366
|
-
emitError(
|
|
1367
|
-
context,
|
|
1368
|
-
18,
|
|
1369
|
-
m.index
|
|
1370
|
-
);
|
|
2209
|
+
function isAllWhitespace(str) {
|
|
2210
|
+
for (let i = 0; i < str.length; i++) {
|
|
2211
|
+
if (!isWhitespace(str.charCodeAt(i))) {
|
|
2212
|
+
return false;
|
|
1371
2213
|
}
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
return { content, isQuoted, loc: getSelection(context, start) };
|
|
1375
|
-
}
|
|
1376
|
-
function parseInterpolation(context, mode) {
|
|
1377
|
-
const [open, close] = context.options.delimiters;
|
|
1378
|
-
const closeIndex = context.source.indexOf(close, open.length);
|
|
1379
|
-
if (closeIndex === -1) {
|
|
1380
|
-
emitError(context, 25);
|
|
1381
|
-
return void 0;
|
|
1382
|
-
}
|
|
1383
|
-
const start = getCursor(context);
|
|
1384
|
-
advanceBy(context, open.length);
|
|
1385
|
-
const innerStart = getCursor(context);
|
|
1386
|
-
const innerEnd = getCursor(context);
|
|
1387
|
-
const rawContentLength = closeIndex - open.length;
|
|
1388
|
-
const rawContent = context.source.slice(0, rawContentLength);
|
|
1389
|
-
const preTrimContent = parseTextData(context, rawContentLength, mode);
|
|
1390
|
-
const content = preTrimContent.trim();
|
|
1391
|
-
const startOffset = preTrimContent.indexOf(content);
|
|
1392
|
-
if (startOffset > 0) {
|
|
1393
|
-
advancePositionWithMutation(innerStart, rawContent, startOffset);
|
|
1394
|
-
}
|
|
1395
|
-
const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
|
|
1396
|
-
advancePositionWithMutation(innerEnd, rawContent, endOffset);
|
|
1397
|
-
advanceBy(context, close.length);
|
|
1398
|
-
return {
|
|
1399
|
-
type: 5,
|
|
1400
|
-
content: {
|
|
1401
|
-
type: 4,
|
|
1402
|
-
isStatic: false,
|
|
1403
|
-
// Set `isConstant` to false by default and will decide in transformExpression
|
|
1404
|
-
constType: 0,
|
|
1405
|
-
content,
|
|
1406
|
-
loc: getSelection(context, innerStart, innerEnd)
|
|
1407
|
-
},
|
|
1408
|
-
loc: getSelection(context, start)
|
|
1409
|
-
};
|
|
2214
|
+
}
|
|
2215
|
+
return true;
|
|
1410
2216
|
}
|
|
1411
|
-
function
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
if (index !== -1 && endIndex > index) {
|
|
1417
|
-
endIndex = index;
|
|
2217
|
+
function hasNewlineChar(str) {
|
|
2218
|
+
for (let i = 0; i < str.length; i++) {
|
|
2219
|
+
const c = str.charCodeAt(i);
|
|
2220
|
+
if (c === 10 || c === 13) {
|
|
2221
|
+
return true;
|
|
1418
2222
|
}
|
|
1419
2223
|
}
|
|
1420
|
-
|
|
1421
|
-
const content = parseTextData(context, endIndex, mode);
|
|
1422
|
-
return {
|
|
1423
|
-
type: 2,
|
|
1424
|
-
content,
|
|
1425
|
-
loc: getSelection(context, start)
|
|
1426
|
-
};
|
|
2224
|
+
return false;
|
|
1427
2225
|
}
|
|
1428
|
-
function
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
2226
|
+
function condense(str) {
|
|
2227
|
+
let ret = "";
|
|
2228
|
+
let prevCharIsWhitespace = false;
|
|
2229
|
+
for (let i = 0; i < str.length; i++) {
|
|
2230
|
+
if (isWhitespace(str.charCodeAt(i))) {
|
|
2231
|
+
if (!prevCharIsWhitespace) {
|
|
2232
|
+
ret += " ";
|
|
2233
|
+
prevCharIsWhitespace = true;
|
|
2234
|
+
}
|
|
2235
|
+
} else {
|
|
2236
|
+
ret += str[i];
|
|
2237
|
+
prevCharIsWhitespace = false;
|
|
2238
|
+
}
|
|
1438
2239
|
}
|
|
2240
|
+
return ret;
|
|
1439
2241
|
}
|
|
1440
|
-
function
|
|
1441
|
-
|
|
1442
|
-
return { column, line, offset };
|
|
2242
|
+
function addNode(node) {
|
|
2243
|
+
(stack[0] || currentRoot).children.push(node);
|
|
1443
2244
|
}
|
|
1444
|
-
function
|
|
1445
|
-
end = end || getCursor(context);
|
|
2245
|
+
function getLoc(start, end) {
|
|
1446
2246
|
return {
|
|
1447
|
-
start,
|
|
1448
|
-
|
|
1449
|
-
|
|
2247
|
+
start: tokenizer.getPos(start),
|
|
2248
|
+
// @ts-expect-error allow late attachment
|
|
2249
|
+
end: end == null ? end : tokenizer.getPos(end),
|
|
2250
|
+
// @ts-expect-error allow late attachment
|
|
2251
|
+
source: end == null ? end : getSlice(start, end)
|
|
1450
2252
|
};
|
|
1451
2253
|
}
|
|
1452
|
-
function
|
|
1453
|
-
|
|
2254
|
+
function setLocEnd(loc, end) {
|
|
2255
|
+
loc.end = tokenizer.getPos(end);
|
|
2256
|
+
loc.source = getSlice(loc.start.offset, end);
|
|
1454
2257
|
}
|
|
1455
|
-
function
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
2258
|
+
function dirToAttr(dir) {
|
|
2259
|
+
const attr = {
|
|
2260
|
+
type: 6,
|
|
2261
|
+
name: dir.rawName,
|
|
2262
|
+
nameLoc: getLoc(
|
|
2263
|
+
dir.loc.start.offset,
|
|
2264
|
+
dir.loc.start.offset + dir.rawName.length
|
|
2265
|
+
),
|
|
2266
|
+
value: void 0,
|
|
2267
|
+
loc: dir.loc
|
|
2268
|
+
};
|
|
2269
|
+
if (dir.exp) {
|
|
2270
|
+
const loc = dir.exp.loc;
|
|
2271
|
+
if (loc.end.offset < dir.loc.end.offset) {
|
|
2272
|
+
loc.start.offset--;
|
|
2273
|
+
loc.start.column--;
|
|
2274
|
+
loc.end.offset++;
|
|
2275
|
+
loc.end.column++;
|
|
2276
|
+
}
|
|
2277
|
+
attr.value = {
|
|
2278
|
+
type: 2,
|
|
2279
|
+
content: dir.exp.content,
|
|
2280
|
+
loc
|
|
2281
|
+
};
|
|
1467
2282
|
}
|
|
2283
|
+
return attr;
|
|
1468
2284
|
}
|
|
1469
|
-
function
|
|
1470
|
-
|
|
1471
|
-
start,
|
|
1472
|
-
context.originalSource.slice(start.offset, numberOfCharacters),
|
|
1473
|
-
numberOfCharacters
|
|
1474
|
-
);
|
|
2285
|
+
function emitError(code, index) {
|
|
2286
|
+
currentOptions.onError(createCompilerError(code, getLoc(index, index)));
|
|
1475
2287
|
}
|
|
1476
|
-
function
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
end: loc,
|
|
1485
|
-
source: ""
|
|
1486
|
-
})
|
|
1487
|
-
);
|
|
2288
|
+
function reset() {
|
|
2289
|
+
tokenizer.reset();
|
|
2290
|
+
currentOpenTag = null;
|
|
2291
|
+
currentProp = null;
|
|
2292
|
+
currentAttrValue = "";
|
|
2293
|
+
currentAttrStartIndex = -1;
|
|
2294
|
+
currentAttrEndIndex = -1;
|
|
2295
|
+
stack.length = 0;
|
|
1488
2296
|
}
|
|
1489
|
-
function
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
break;
|
|
1501
|
-
case 1:
|
|
1502
|
-
case 2: {
|
|
1503
|
-
const parent = last(ancestors);
|
|
1504
|
-
if (parent && startsWithEndTagOpen(s, parent.tag)) {
|
|
1505
|
-
return true;
|
|
2297
|
+
function baseParse(input, options) {
|
|
2298
|
+
reset();
|
|
2299
|
+
currentInput = input;
|
|
2300
|
+
currentOptions = shared.extend({}, defaultParserOptions);
|
|
2301
|
+
if (options) {
|
|
2302
|
+
let key;
|
|
2303
|
+
for (key in options) {
|
|
2304
|
+
if (options[key] != null) {
|
|
2305
|
+
currentOptions[key] = options[key];
|
|
1506
2306
|
}
|
|
1507
|
-
break;
|
|
1508
2307
|
}
|
|
1509
|
-
case 3:
|
|
1510
|
-
if (startsWith(s, "]]>")) {
|
|
1511
|
-
return true;
|
|
1512
|
-
}
|
|
1513
|
-
break;
|
|
1514
2308
|
}
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
2309
|
+
{
|
|
2310
|
+
if (currentOptions.decodeEntities) {
|
|
2311
|
+
console.warn(
|
|
2312
|
+
`[@vue/compiler-core] decodeEntities option is passed but will be ignored in non-browser builds.`
|
|
2313
|
+
);
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
2317
|
+
const delimiters = options == null ? void 0 : options.delimiters;
|
|
2318
|
+
if (delimiters) {
|
|
2319
|
+
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
2320
|
+
tokenizer.delimiterClose = toCharCodes(delimiters[1]);
|
|
2321
|
+
}
|
|
2322
|
+
const root = currentRoot = createRoot([], input);
|
|
2323
|
+
tokenizer.parse(currentInput);
|
|
2324
|
+
root.loc = getLoc(0, input.length);
|
|
2325
|
+
root.children = condenseWhitespace(root.children);
|
|
2326
|
+
currentRoot = null;
|
|
2327
|
+
return root;
|
|
1519
2328
|
}
|
|
1520
2329
|
|
|
1521
2330
|
function hoistStatic(root, context) {
|
|
@@ -1955,6 +2764,7 @@ function transform(root, options) {
|
|
|
1955
2764
|
root.hoists = context.hoists;
|
|
1956
2765
|
root.temps = context.temps;
|
|
1957
2766
|
root.cached = context.cached;
|
|
2767
|
+
root.transformed = true;
|
|
1958
2768
|
{
|
|
1959
2769
|
root.filters = [...context.filters];
|
|
1960
2770
|
}
|
|
@@ -2111,7 +2921,7 @@ function createCodegenContext(ast, {
|
|
|
2111
2921
|
ssr,
|
|
2112
2922
|
isTS,
|
|
2113
2923
|
inSSR,
|
|
2114
|
-
source: ast.
|
|
2924
|
+
source: ast.source,
|
|
2115
2925
|
code: ``,
|
|
2116
2926
|
column: 1,
|
|
2117
2927
|
line: 1,
|
|
@@ -2122,7 +2932,7 @@ function createCodegenContext(ast, {
|
|
|
2122
2932
|
helper(key) {
|
|
2123
2933
|
return `_${helperNameMap[key]}`;
|
|
2124
2934
|
},
|
|
2125
|
-
push(code, node) {
|
|
2935
|
+
push(code, newlineIndex = -2 /* None */, node) {
|
|
2126
2936
|
context.code += code;
|
|
2127
2937
|
if (context.map) {
|
|
2128
2938
|
if (node) {
|
|
@@ -2135,7 +2945,20 @@ function createCodegenContext(ast, {
|
|
|
2135
2945
|
}
|
|
2136
2946
|
addMapping(node.loc.start, name);
|
|
2137
2947
|
}
|
|
2138
|
-
|
|
2948
|
+
if (newlineIndex === -3 /* Unknown */) {
|
|
2949
|
+
advancePositionWithMutation(context, code);
|
|
2950
|
+
} else {
|
|
2951
|
+
context.offset += code.length;
|
|
2952
|
+
if (newlineIndex === -2 /* None */) {
|
|
2953
|
+
context.column += code.length;
|
|
2954
|
+
} else {
|
|
2955
|
+
if (newlineIndex === -1 /* End */) {
|
|
2956
|
+
newlineIndex = code.length - 1;
|
|
2957
|
+
}
|
|
2958
|
+
context.line++;
|
|
2959
|
+
context.column = code.length - newlineIndex;
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2139
2962
|
if (node && node.loc !== locStub) {
|
|
2140
2963
|
addMapping(node.loc.end);
|
|
2141
2964
|
}
|
|
@@ -2156,26 +2979,27 @@ function createCodegenContext(ast, {
|
|
|
2156
2979
|
}
|
|
2157
2980
|
};
|
|
2158
2981
|
function newline(n) {
|
|
2159
|
-
context.push("\n" + ` `.repeat(n));
|
|
2160
|
-
}
|
|
2161
|
-
function addMapping(loc, name) {
|
|
2162
|
-
context.map
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2982
|
+
context.push("\n" + ` `.repeat(n), 0 /* Start */);
|
|
2983
|
+
}
|
|
2984
|
+
function addMapping(loc, name = null) {
|
|
2985
|
+
const { _names, _mappings } = context.map;
|
|
2986
|
+
if (name !== null && !_names.has(name))
|
|
2987
|
+
_names.add(name);
|
|
2988
|
+
_mappings.add({
|
|
2989
|
+
originalLine: loc.line,
|
|
2990
|
+
originalColumn: loc.column - 1,
|
|
2991
|
+
// source-map column is 0 based
|
|
2992
|
+
generatedLine: context.line,
|
|
2993
|
+
generatedColumn: context.column - 1,
|
|
2994
|
+
source: filename,
|
|
2995
|
+
// @ts-ignore it is possible to be null
|
|
2996
|
+
name
|
|
2174
2997
|
});
|
|
2175
2998
|
}
|
|
2176
2999
|
if (sourceMap) {
|
|
2177
3000
|
context.map = new sourceMapJs.SourceMapGenerator();
|
|
2178
3001
|
context.map.setSourceContent(filename, context.source);
|
|
3002
|
+
context.map._sources.add(filename);
|
|
2179
3003
|
}
|
|
2180
3004
|
return context;
|
|
2181
3005
|
}
|
|
@@ -2220,9 +3044,11 @@ function generate(ast, options = {}) {
|
|
|
2220
3044
|
push(`with (_ctx) {`);
|
|
2221
3045
|
indent();
|
|
2222
3046
|
if (hasHelpers) {
|
|
2223
|
-
push(
|
|
2224
|
-
|
|
2225
|
-
|
|
3047
|
+
push(
|
|
3048
|
+
`const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
|
|
3049
|
+
`,
|
|
3050
|
+
-1 /* End */
|
|
3051
|
+
);
|
|
2226
3052
|
newline();
|
|
2227
3053
|
}
|
|
2228
3054
|
}
|
|
@@ -2251,7 +3077,7 @@ function generate(ast, options = {}) {
|
|
|
2251
3077
|
}
|
|
2252
3078
|
if (ast.components.length || ast.directives.length || ast.temps) {
|
|
2253
3079
|
push(`
|
|
2254
|
-
|
|
3080
|
+
`, 0 /* Start */);
|
|
2255
3081
|
newline();
|
|
2256
3082
|
}
|
|
2257
3083
|
if (!ssr) {
|
|
@@ -2272,7 +3098,6 @@ function generate(ast, options = {}) {
|
|
|
2272
3098
|
ast,
|
|
2273
3099
|
code: context.code,
|
|
2274
3100
|
preamble: isSetupInlined ? preambleContext.code : ``,
|
|
2275
|
-
// SourceMapGenerator does have toJSON() method but it's not in the types
|
|
2276
3101
|
map: context.map ? context.map.toJSON() : void 0
|
|
2277
3102
|
};
|
|
2278
3103
|
}
|
|
@@ -2290,11 +3115,14 @@ function genFunctionPreamble(ast, context) {
|
|
|
2290
3115
|
const helpers = Array.from(ast.helpers);
|
|
2291
3116
|
if (helpers.length > 0) {
|
|
2292
3117
|
if (prefixIdentifiers) {
|
|
2293
|
-
push(
|
|
2294
|
-
`)
|
|
3118
|
+
push(
|
|
3119
|
+
`const { ${helpers.map(aliasHelper).join(", ")} } = ${VueBinding}
|
|
3120
|
+
`,
|
|
3121
|
+
-1 /* End */
|
|
3122
|
+
);
|
|
2295
3123
|
} else {
|
|
2296
3124
|
push(`const _Vue = ${VueBinding}
|
|
2297
|
-
|
|
3125
|
+
`, -1 /* End */);
|
|
2298
3126
|
if (ast.hoists.length) {
|
|
2299
3127
|
const staticHelpers = [
|
|
2300
3128
|
CREATE_VNODE,
|
|
@@ -2304,14 +3132,15 @@ function genFunctionPreamble(ast, context) {
|
|
|
2304
3132
|
CREATE_STATIC
|
|
2305
3133
|
].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
|
|
2306
3134
|
push(`const { ${staticHelpers} } = _Vue
|
|
2307
|
-
|
|
3135
|
+
`, -1 /* End */);
|
|
2308
3136
|
}
|
|
2309
3137
|
}
|
|
2310
3138
|
}
|
|
2311
3139
|
if (ast.ssrHelpers && ast.ssrHelpers.length) {
|
|
2312
3140
|
push(
|
|
2313
3141
|
`const { ${ast.ssrHelpers.map(aliasHelper).join(", ")} } = require("${ssrRuntimeModuleName}")
|
|
2314
|
-
|
|
3142
|
+
`,
|
|
3143
|
+
-1 /* End */
|
|
2315
3144
|
);
|
|
2316
3145
|
}
|
|
2317
3146
|
genHoists(ast.hoists, context);
|
|
@@ -2335,25 +3164,29 @@ function genModulePreamble(ast, context, genScopeId, inline) {
|
|
|
2335
3164
|
if (optimizeImports) {
|
|
2336
3165
|
push(
|
|
2337
3166
|
`import { ${helpers.map((s) => helperNameMap[s]).join(", ")} } from ${JSON.stringify(runtimeModuleName)}
|
|
2338
|
-
|
|
3167
|
+
`,
|
|
3168
|
+
-1 /* End */
|
|
2339
3169
|
);
|
|
2340
3170
|
push(
|
|
2341
3171
|
`
|
|
2342
3172
|
// Binding optimization for webpack code-split
|
|
2343
3173
|
const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(", ")}
|
|
2344
|
-
|
|
3174
|
+
`,
|
|
3175
|
+
-1 /* End */
|
|
2345
3176
|
);
|
|
2346
3177
|
} else {
|
|
2347
3178
|
push(
|
|
2348
3179
|
`import { ${helpers.map((s) => `${helperNameMap[s]} as _${helperNameMap[s]}`).join(", ")} } from ${JSON.stringify(runtimeModuleName)}
|
|
2349
|
-
|
|
3180
|
+
`,
|
|
3181
|
+
-1 /* End */
|
|
2350
3182
|
);
|
|
2351
3183
|
}
|
|
2352
3184
|
}
|
|
2353
3185
|
if (ast.ssrHelpers && ast.ssrHelpers.length) {
|
|
2354
3186
|
push(
|
|
2355
3187
|
`import { ${ast.ssrHelpers.map((s) => `${helperNameMap[s]} as _${helperNameMap[s]}`).join(", ")} } from "${ssrRuntimeModuleName}"
|
|
2356
|
-
|
|
3188
|
+
`,
|
|
3189
|
+
-1 /* End */
|
|
2357
3190
|
);
|
|
2358
3191
|
}
|
|
2359
3192
|
if (ast.imports.length) {
|
|
@@ -2443,7 +3276,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
|
|
|
2443
3276
|
for (let i = 0; i < nodes.length; i++) {
|
|
2444
3277
|
const node = nodes[i];
|
|
2445
3278
|
if (shared.isString(node)) {
|
|
2446
|
-
push(node);
|
|
3279
|
+
push(node, -3 /* Unknown */);
|
|
2447
3280
|
} else if (shared.isArray(node)) {
|
|
2448
3281
|
genNodeListAsArray(node, context);
|
|
2449
3282
|
} else {
|
|
@@ -2461,7 +3294,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
|
|
|
2461
3294
|
}
|
|
2462
3295
|
function genNode(node, context) {
|
|
2463
3296
|
if (shared.isString(node)) {
|
|
2464
|
-
context.push(node);
|
|
3297
|
+
context.push(node, -3 /* Unknown */);
|
|
2465
3298
|
return;
|
|
2466
3299
|
}
|
|
2467
3300
|
if (shared.isSymbol(node)) {
|
|
@@ -2546,11 +3379,15 @@ function genNode(node, context) {
|
|
|
2546
3379
|
}
|
|
2547
3380
|
}
|
|
2548
3381
|
function genText(node, context) {
|
|
2549
|
-
context.push(JSON.stringify(node.content), node);
|
|
3382
|
+
context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
|
|
2550
3383
|
}
|
|
2551
3384
|
function genExpression(node, context) {
|
|
2552
3385
|
const { content, isStatic } = node;
|
|
2553
|
-
context.push(
|
|
3386
|
+
context.push(
|
|
3387
|
+
isStatic ? JSON.stringify(content) : content,
|
|
3388
|
+
-3 /* Unknown */,
|
|
3389
|
+
node
|
|
3390
|
+
);
|
|
2554
3391
|
}
|
|
2555
3392
|
function genInterpolation(node, context) {
|
|
2556
3393
|
const { push, helper, pure } = context;
|
|
@@ -2564,7 +3401,7 @@ function genCompoundExpression(node, context) {
|
|
|
2564
3401
|
for (let i = 0; i < node.children.length; i++) {
|
|
2565
3402
|
const child = node.children[i];
|
|
2566
3403
|
if (shared.isString(child)) {
|
|
2567
|
-
context.push(child);
|
|
3404
|
+
context.push(child, -3 /* Unknown */);
|
|
2568
3405
|
} else {
|
|
2569
3406
|
genNode(child, context);
|
|
2570
3407
|
}
|
|
@@ -2578,9 +3415,9 @@ function genExpressionAsPropertyKey(node, context) {
|
|
|
2578
3415
|
push(`]`);
|
|
2579
3416
|
} else if (node.isStatic) {
|
|
2580
3417
|
const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
|
|
2581
|
-
push(text, node);
|
|
3418
|
+
push(text, -2 /* None */, node);
|
|
2582
3419
|
} else {
|
|
2583
|
-
push(`[${node.content}]`, node);
|
|
3420
|
+
push(`[${node.content}]`, -3 /* Unknown */, node);
|
|
2584
3421
|
}
|
|
2585
3422
|
}
|
|
2586
3423
|
function genComment(node, context) {
|
|
@@ -2588,7 +3425,11 @@ function genComment(node, context) {
|
|
|
2588
3425
|
if (pure) {
|
|
2589
3426
|
push(PURE_ANNOTATION);
|
|
2590
3427
|
}
|
|
2591
|
-
push(
|
|
3428
|
+
push(
|
|
3429
|
+
`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
|
|
3430
|
+
-3 /* Unknown */,
|
|
3431
|
+
node
|
|
3432
|
+
);
|
|
2592
3433
|
}
|
|
2593
3434
|
function genVNodeCall(node, context) {
|
|
2594
3435
|
const { push, helper, pure } = context;
|
|
@@ -2613,7 +3454,7 @@ function genVNodeCall(node, context) {
|
|
|
2613
3454
|
push(PURE_ANNOTATION);
|
|
2614
3455
|
}
|
|
2615
3456
|
const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
|
|
2616
|
-
push(helper(callHelper) + `(`, node);
|
|
3457
|
+
push(helper(callHelper) + `(`, -2 /* None */, node);
|
|
2617
3458
|
genNodeList(
|
|
2618
3459
|
genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
|
|
2619
3460
|
context
|
|
@@ -2642,7 +3483,7 @@ function genCallExpression(node, context) {
|
|
|
2642
3483
|
if (pure) {
|
|
2643
3484
|
push(PURE_ANNOTATION);
|
|
2644
3485
|
}
|
|
2645
|
-
push(callee + `(`, node);
|
|
3486
|
+
push(callee + `(`, -2 /* None */, node);
|
|
2646
3487
|
genNodeList(node.arguments, context);
|
|
2647
3488
|
push(`)`);
|
|
2648
3489
|
}
|
|
@@ -2650,7 +3491,7 @@ function genObjectExpression(node, context) {
|
|
|
2650
3491
|
const { push, indent, deindent, newline } = context;
|
|
2651
3492
|
const { properties } = node;
|
|
2652
3493
|
if (!properties.length) {
|
|
2653
|
-
push(`{}`, node);
|
|
3494
|
+
push(`{}`, -2 /* None */, node);
|
|
2654
3495
|
return;
|
|
2655
3496
|
}
|
|
2656
3497
|
const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
|
|
@@ -2678,7 +3519,7 @@ function genFunctionExpression(node, context) {
|
|
|
2678
3519
|
if (isSlot) {
|
|
2679
3520
|
push(`_${helperNameMap[WITH_CTX]}(`);
|
|
2680
3521
|
}
|
|
2681
|
-
push(`(`, node);
|
|
3522
|
+
push(`(`, -2 /* None */, node);
|
|
2682
3523
|
if (shared.isArray(params)) {
|
|
2683
3524
|
genNodeList(params, context);
|
|
2684
3525
|
} else if (params) {
|
|
@@ -2775,7 +3616,7 @@ function genTemplateLiteral(node, context) {
|
|
|
2775
3616
|
for (let i = 0; i < l; i++) {
|
|
2776
3617
|
const e = node.elements[i];
|
|
2777
3618
|
if (shared.isString(e)) {
|
|
2778
|
-
push(e.replace(/(`|\$|\\)/g, "\\$1"));
|
|
3619
|
+
push(e.replace(/(`|\$|\\)/g, "\\$1"), -3 /* Unknown */);
|
|
2779
3620
|
} else {
|
|
2780
3621
|
push("${");
|
|
2781
3622
|
if (multilines)
|
|
@@ -2923,6 +3764,15 @@ function walkBlockDeclarations(block, onIdent) {
|
|
|
2923
3764
|
if (stmt.declare || !stmt.id)
|
|
2924
3765
|
continue;
|
|
2925
3766
|
onIdent(stmt.id);
|
|
3767
|
+
} else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
|
|
3768
|
+
const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
|
|
3769
|
+
if (variable && variable.type === "VariableDeclaration") {
|
|
3770
|
+
for (const decl of variable.declarations) {
|
|
3771
|
+
for (const id of extractIdentifiers(decl.id)) {
|
|
3772
|
+
onIdent(id);
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
2926
3776
|
}
|
|
2927
3777
|
}
|
|
2928
3778
|
}
|
|
@@ -3175,8 +4025,8 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
3175
4025
|
const isScopeVarReference = context.identifiers[rawExp];
|
|
3176
4026
|
const isAllowedGlobal = shared.isGloballyAllowed(rawExp);
|
|
3177
4027
|
const isLiteral = isLiteralWhitelisted(rawExp);
|
|
3178
|
-
if (!asParams && !isScopeVarReference && !
|
|
3179
|
-
if (isConst(bindingMetadata[
|
|
4028
|
+
if (!asParams && !isScopeVarReference && !isLiteral && (!isAllowedGlobal || bindingMetadata[rawExp])) {
|
|
4029
|
+
if (isConst(bindingMetadata[rawExp])) {
|
|
3180
4030
|
node.constType = 1;
|
|
3181
4031
|
}
|
|
3182
4032
|
node.content = rewriteIdentifier(rawExp);
|
|
@@ -3253,9 +4103,9 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
3253
4103
|
id.name,
|
|
3254
4104
|
false,
|
|
3255
4105
|
{
|
|
3256
|
-
source: source2,
|
|
3257
4106
|
start: advancePositionWithClone(node.loc.start, source2, start),
|
|
3258
|
-
end: advancePositionWithClone(node.loc.start, source2, end)
|
|
4107
|
+
end: advancePositionWithClone(node.loc.start, source2, end),
|
|
4108
|
+
source: source2
|
|
3259
4109
|
},
|
|
3260
4110
|
id.isConstant ? 3 : 0
|
|
3261
4111
|
)
|
|
@@ -3374,7 +4224,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3374
4224
|
context.removeNode();
|
|
3375
4225
|
const branch = createIfBranch(node, dir);
|
|
3376
4226
|
if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
|
|
3377
|
-
!(context.parent && context.parent.type === 1 &&
|
|
4227
|
+
!(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
|
|
3378
4228
|
branch.children = [...comments, ...branch.children];
|
|
3379
4229
|
}
|
|
3380
4230
|
{
|
|
@@ -3670,18 +4520,14 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
3670
4520
|
);
|
|
3671
4521
|
return;
|
|
3672
4522
|
}
|
|
3673
|
-
const parseResult =
|
|
3674
|
-
// can only be simple expression because vFor transform is applied
|
|
3675
|
-
// before expression transform.
|
|
3676
|
-
dir.exp,
|
|
3677
|
-
context
|
|
3678
|
-
);
|
|
4523
|
+
const parseResult = dir.forParseResult;
|
|
3679
4524
|
if (!parseResult) {
|
|
3680
4525
|
context.onError(
|
|
3681
4526
|
createCompilerError(32, dir.loc)
|
|
3682
4527
|
);
|
|
3683
4528
|
return;
|
|
3684
4529
|
}
|
|
4530
|
+
finalizeForParseResult(parseResult, context);
|
|
3685
4531
|
const { addIdentifiers, removeIdentifiers, scopes } = context;
|
|
3686
4532
|
const { source, value, key, index } = parseResult;
|
|
3687
4533
|
const forNode = {
|
|
@@ -3713,77 +4559,37 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
3713
4559
|
onExit();
|
|
3714
4560
|
};
|
|
3715
4561
|
}
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
const stripParensRE = /^\(|\)$/g;
|
|
3719
|
-
function parseForExpression(input, context) {
|
|
3720
|
-
const loc = input.loc;
|
|
3721
|
-
const exp = input.content;
|
|
3722
|
-
const inMatch = exp.match(forAliasRE);
|
|
3723
|
-
if (!inMatch)
|
|
4562
|
+
function finalizeForParseResult(result, context) {
|
|
4563
|
+
if (result.finalized)
|
|
3724
4564
|
return;
|
|
3725
|
-
const [, LHS, RHS] = inMatch;
|
|
3726
|
-
const result = {
|
|
3727
|
-
source: createAliasExpression(
|
|
3728
|
-
loc,
|
|
3729
|
-
RHS.trim(),
|
|
3730
|
-
exp.indexOf(RHS, LHS.length)
|
|
3731
|
-
),
|
|
3732
|
-
value: void 0,
|
|
3733
|
-
key: void 0,
|
|
3734
|
-
index: void 0
|
|
3735
|
-
};
|
|
3736
4565
|
if (context.prefixIdentifiers) {
|
|
3737
4566
|
result.source = processExpression(
|
|
3738
4567
|
result.source,
|
|
3739
4568
|
context
|
|
3740
4569
|
);
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
const keyContent = iteratorMatch[1].trim();
|
|
3748
|
-
let keyOffset;
|
|
3749
|
-
if (keyContent) {
|
|
3750
|
-
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
3751
|
-
result.key = createAliasExpression(loc, keyContent, keyOffset);
|
|
3752
|
-
if (context.prefixIdentifiers) {
|
|
3753
|
-
result.key = processExpression(result.key, context, true);
|
|
3754
|
-
}
|
|
4570
|
+
if (result.key) {
|
|
4571
|
+
result.key = processExpression(
|
|
4572
|
+
result.key,
|
|
4573
|
+
context,
|
|
4574
|
+
true
|
|
4575
|
+
);
|
|
3755
4576
|
}
|
|
3756
|
-
if (
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
exp.indexOf(
|
|
3763
|
-
indexContent,
|
|
3764
|
-
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
3765
|
-
)
|
|
3766
|
-
);
|
|
3767
|
-
if (context.prefixIdentifiers) {
|
|
3768
|
-
result.index = processExpression(result.index, context, true);
|
|
3769
|
-
}
|
|
3770
|
-
}
|
|
4577
|
+
if (result.index) {
|
|
4578
|
+
result.index = processExpression(
|
|
4579
|
+
result.index,
|
|
4580
|
+
context,
|
|
4581
|
+
true
|
|
4582
|
+
);
|
|
3771
4583
|
}
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
4584
|
+
if (result.value) {
|
|
4585
|
+
result.value = processExpression(
|
|
4586
|
+
result.value,
|
|
4587
|
+
context,
|
|
4588
|
+
true
|
|
4589
|
+
);
|
|
3777
4590
|
}
|
|
3778
4591
|
}
|
|
3779
|
-
|
|
3780
|
-
}
|
|
3781
|
-
function createAliasExpression(range, content, offset) {
|
|
3782
|
-
return createSimpleExpression(
|
|
3783
|
-
content,
|
|
3784
|
-
false,
|
|
3785
|
-
getInnerRange(range, offset, content.length)
|
|
3786
|
-
);
|
|
4592
|
+
result.finalized = true;
|
|
3787
4593
|
}
|
|
3788
4594
|
function createForLoopParams({ value, key, index }, memoArgs = []) {
|
|
3789
4595
|
return createParamsList([value, key, index, ...memoArgs]);
|
|
@@ -3819,11 +4625,9 @@ const trackSlotScopes = (node, context) => {
|
|
|
3819
4625
|
const trackVForSlotScopes = (node, context) => {
|
|
3820
4626
|
let vFor;
|
|
3821
4627
|
if (isTemplateNode(node) && node.props.some(isVSlot) && (vFor = findDir(node, "for"))) {
|
|
3822
|
-
const result = vFor.
|
|
3823
|
-
vFor.exp,
|
|
3824
|
-
context
|
|
3825
|
-
);
|
|
4628
|
+
const result = vFor.forParseResult;
|
|
3826
4629
|
if (result) {
|
|
4630
|
+
finalizeForParseResult(result, context);
|
|
3827
4631
|
const { value, key, index } = result;
|
|
3828
4632
|
const { addIdentifiers, removeIdentifiers } = context;
|
|
3829
4633
|
value && addIdentifiers(value);
|
|
@@ -3900,12 +4704,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3900
4704
|
hasDynamicSlots = true;
|
|
3901
4705
|
}
|
|
3902
4706
|
const vFor = findDir(slotElement, "for");
|
|
3903
|
-
const slotFunction = buildSlotFn(
|
|
3904
|
-
slotProps,
|
|
3905
|
-
vFor == null ? void 0 : vFor.exp,
|
|
3906
|
-
slotChildren,
|
|
3907
|
-
slotLoc
|
|
3908
|
-
);
|
|
4707
|
+
const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
|
|
3909
4708
|
let vIf;
|
|
3910
4709
|
let vElse;
|
|
3911
4710
|
if (vIf = findDir(slotElement, "if")) {
|
|
@@ -3954,8 +4753,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3954
4753
|
}
|
|
3955
4754
|
} else if (vFor) {
|
|
3956
4755
|
hasDynamicSlots = true;
|
|
3957
|
-
const parseResult = vFor.
|
|
4756
|
+
const parseResult = vFor.forParseResult;
|
|
3958
4757
|
if (parseResult) {
|
|
4758
|
+
finalizeForParseResult(parseResult, context);
|
|
3959
4759
|
dynamicSlots.push(
|
|
3960
4760
|
createCallExpression(context.helper(RENDER_LIST), [
|
|
3961
4761
|
parseResult.source,
|
|
@@ -4216,17 +5016,6 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
4216
5016
|
tag = isProp.value.content.slice(4);
|
|
4217
5017
|
}
|
|
4218
5018
|
}
|
|
4219
|
-
const isDir = !isExplicitDynamic && findDir(node, "is");
|
|
4220
|
-
if (isDir && isDir.exp) {
|
|
4221
|
-
{
|
|
4222
|
-
context.onWarn(
|
|
4223
|
-
createCompilerError(52, isDir.loc)
|
|
4224
|
-
);
|
|
4225
|
-
}
|
|
4226
|
-
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
|
4227
|
-
isDir.exp
|
|
4228
|
-
]);
|
|
4229
|
-
}
|
|
4230
5019
|
const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
|
|
4231
5020
|
if (builtIn) {
|
|
4232
5021
|
if (!ssr)
|
|
@@ -4349,7 +5138,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4349
5138
|
for (let i = 0; i < props.length; i++) {
|
|
4350
5139
|
const prop = props[i];
|
|
4351
5140
|
if (prop.type === 6) {
|
|
4352
|
-
const { loc, name, value } = prop;
|
|
5141
|
+
const { loc, name, nameLoc, value } = prop;
|
|
4353
5142
|
let isStatic = true;
|
|
4354
5143
|
if (name === "ref") {
|
|
4355
5144
|
hasRef = true;
|
|
@@ -4382,11 +5171,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4382
5171
|
}
|
|
4383
5172
|
properties.push(
|
|
4384
5173
|
createObjectProperty(
|
|
4385
|
-
createSimpleExpression(
|
|
4386
|
-
name,
|
|
4387
|
-
true,
|
|
4388
|
-
getInnerRange(loc, 0, name.length)
|
|
4389
|
-
),
|
|
5174
|
+
createSimpleExpression(name, true, nameLoc),
|
|
4390
5175
|
createSimpleExpression(
|
|
4391
5176
|
value ? value.content : "",
|
|
4392
5177
|
isStatic,
|
|
@@ -4395,7 +5180,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4395
5180
|
)
|
|
4396
5181
|
);
|
|
4397
5182
|
} else {
|
|
4398
|
-
const { name, arg, exp, loc } = prop;
|
|
5183
|
+
const { name, arg, exp, loc, modifiers } = prop;
|
|
4399
5184
|
const isVBind = name === "bind";
|
|
4400
5185
|
const isVOn = name === "on";
|
|
4401
5186
|
if (name === "slot") {
|
|
@@ -4488,6 +5273,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4488
5273
|
}
|
|
4489
5274
|
continue;
|
|
4490
5275
|
}
|
|
5276
|
+
if (isVBind && modifiers.includes("prop")) {
|
|
5277
|
+
patchFlag |= 32;
|
|
5278
|
+
}
|
|
4491
5279
|
const directiveTransform = context.directiveTransforms[name];
|
|
4492
5280
|
if (directiveTransform) {
|
|
4493
5281
|
const { props: props2, needRuntime } = directiveTransform(prop, node, context);
|
|
@@ -4890,8 +5678,16 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
4890
5678
|
};
|
|
4891
5679
|
|
|
4892
5680
|
const transformBind = (dir, _node, context) => {
|
|
4893
|
-
const {
|
|
5681
|
+
const { modifiers, loc } = dir;
|
|
4894
5682
|
const arg = dir.arg;
|
|
5683
|
+
let { exp } = dir;
|
|
5684
|
+
if (!exp && arg.type === 4) {
|
|
5685
|
+
const propName = shared.camelize(arg.content);
|
|
5686
|
+
exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
5687
|
+
{
|
|
5688
|
+
exp = dir.exp = processExpression(exp, context);
|
|
5689
|
+
}
|
|
5690
|
+
}
|
|
4895
5691
|
if (arg.type !== 4) {
|
|
4896
5692
|
arg.children.unshift(`(`);
|
|
4897
5693
|
arg.children.push(`) || ""`);
|
|
@@ -5318,7 +6114,7 @@ function getBaseTransformPreset(prefixIdentifiers) {
|
|
|
5318
6114
|
}
|
|
5319
6115
|
];
|
|
5320
6116
|
}
|
|
5321
|
-
function baseCompile(
|
|
6117
|
+
function baseCompile(source, options = {}) {
|
|
5322
6118
|
const onError = options.onError || defaultOnError;
|
|
5323
6119
|
const isModuleMode = options.mode === "module";
|
|
5324
6120
|
const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
|
|
@@ -5328,7 +6124,7 @@ function baseCompile(template, options = {}) {
|
|
|
5328
6124
|
if (options.scopeId && !isModuleMode) {
|
|
5329
6125
|
onError(createCompilerError(50));
|
|
5330
6126
|
}
|
|
5331
|
-
const ast = shared.isString(
|
|
6127
|
+
const ast = shared.isString(source) ? baseParse(source, options) : source;
|
|
5332
6128
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|
|
5333
6129
|
if (options.isTS) {
|
|
5334
6130
|
const { expressionPlugins } = options;
|
|
@@ -5440,10 +6236,10 @@ exports.errorMessages = errorMessages;
|
|
|
5440
6236
|
exports.extractIdentifiers = extractIdentifiers;
|
|
5441
6237
|
exports.findDir = findDir;
|
|
5442
6238
|
exports.findProp = findProp;
|
|
6239
|
+
exports.forAliasRE = forAliasRE;
|
|
5443
6240
|
exports.generate = generate;
|
|
5444
6241
|
exports.getBaseTransformPreset = getBaseTransformPreset;
|
|
5445
6242
|
exports.getConstantType = getConstantType;
|
|
5446
|
-
exports.getInnerRange = getInnerRange;
|
|
5447
6243
|
exports.getMemoedVNodeCall = getMemoedVNodeCall;
|
|
5448
6244
|
exports.getVNodeBlockHelper = getVNodeBlockHelper;
|
|
5449
6245
|
exports.getVNodeHelper = getVNodeHelper;
|
|
@@ -5451,7 +6247,6 @@ exports.hasDynamicKeyVBind = hasDynamicKeyVBind;
|
|
|
5451
6247
|
exports.hasScopeRef = hasScopeRef;
|
|
5452
6248
|
exports.helperNameMap = helperNameMap;
|
|
5453
6249
|
exports.injectProp = injectProp;
|
|
5454
|
-
exports.isBuiltInType = isBuiltInType;
|
|
5455
6250
|
exports.isCoreComponent = isCoreComponent;
|
|
5456
6251
|
exports.isFunctionType = isFunctionType;
|
|
5457
6252
|
exports.isInDestructureAssignment = isInDestructureAssignment;
|