@vtj/parser 0.12.4 → 0.12.6
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/index.cjs +6 -6
- package/dist/index.mjs +370 -352
- package/package.json +3 -3
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { parse as qu, compileTemplate as ku } from "@vue/compiler-sfc";
|
2
2
|
import { parse as _u } from "@babel/parser";
|
3
|
-
import
|
3
|
+
import z from "@babel/traverse";
|
4
4
|
import W from "@babel/generator";
|
5
5
|
import { BlockModel as Lu } from "@vtj/core";
|
6
6
|
import { tsFormatter as Q } from "@vtj/coder";
|
@@ -11,23 +11,23 @@ import Ru from "postcss";
|
|
11
11
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
12
12
|
* @name @vtj/parser
|
13
13
|
* @author CHC chenhuachun1549@dingtalk.com
|
14
|
-
* @version 0.12.
|
14
|
+
* @version 0.12.6
|
15
15
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
16
16
|
*/
|
17
|
-
const
|
17
|
+
const F0 = "0.12.6";
|
18
18
|
function su(e) {
|
19
|
-
const { descriptor: u } = qu(e), t = u.template?.content || "", a = (u.scriptSetup || u.script)?.content || "",
|
19
|
+
const { descriptor: u } = qu(e), t = u.template?.content || "", a = (u.scriptSetup || u.script)?.content || "", i = u.styles.map((c) => c.content);
|
20
20
|
return {
|
21
21
|
template: t,
|
22
22
|
script: a,
|
23
|
-
styles:
|
23
|
+
styles: i
|
24
24
|
};
|
25
25
|
}
|
26
26
|
function ru(e) {
|
27
27
|
return _u(e, { sourceType: "module", plugins: ["typescript"] });
|
28
28
|
}
|
29
29
|
function nu(e, u) {
|
30
|
-
return (
|
30
|
+
return (z.default || z)(e, u);
|
31
31
|
}
|
32
32
|
function R(e) {
|
33
33
|
try {
|
@@ -55,14 +55,14 @@ function G(e) {
|
|
55
55
|
function Vu(e) {
|
56
56
|
return !!e && !H(e) && typeof e != "string";
|
57
57
|
}
|
58
|
-
function
|
58
|
+
function j0(e) {
|
59
59
|
const u = su(e), t = ru(u.script), a = {};
|
60
60
|
return u.styles && (a.css = u.styles[0] || ""), nu(t, {
|
61
|
-
CallExpression(
|
62
|
-
const
|
63
|
-
if (
|
64
|
-
const s = R(
|
65
|
-
s && (a[
|
61
|
+
CallExpression(i) {
|
62
|
+
const c = i.node.callee?.name;
|
63
|
+
if (c) {
|
64
|
+
const s = R(i.node.arguments[0]);
|
65
|
+
s && (a[c] = {
|
66
66
|
type: "JSFunction",
|
67
67
|
value: s
|
68
68
|
});
|
@@ -71,31 +71,31 @@ function F0(e) {
|
|
71
71
|
}), a;
|
72
72
|
}
|
73
73
|
function O(e, u, t) {
|
74
|
-
const a = new RegExp(`${u}`, "g"),
|
75
|
-
return e.replace(a, (
|
76
|
-
const
|
77
|
-
return
|
78
|
-
});
|
74
|
+
const a = new RegExp(`${u}`, "g"), i = /(\@\_|\$|\.|\,|\w)$/, c = /^\w/, s = new RegExp(`^this.${u}$`, "g");
|
75
|
+
return e.replace(a, (d, b, h) => {
|
76
|
+
const o = h.substring(0, b), S = h.substring(b + u.length);
|
77
|
+
return i.test(o.trim()) || c.test(S.trim()) ? d : t;
|
78
|
+
}).replace(s, t);
|
79
79
|
}
|
80
80
|
function Z(e, u, t) {
|
81
81
|
const {
|
82
82
|
context: a = {},
|
83
|
-
computed:
|
84
|
-
libs:
|
83
|
+
computed: i = [],
|
84
|
+
libs: c = {},
|
85
85
|
members: s = []
|
86
86
|
} = t || {}, n = Array.from(a[u || ""] || /* @__PURE__ */ new Set());
|
87
87
|
if (n)
|
88
88
|
for (const d of n)
|
89
89
|
e = O(e, d, `this.context.${d}`);
|
90
|
-
for (const d of
|
90
|
+
for (const d of i)
|
91
91
|
e = O(e, d, `this.${d}.value`);
|
92
|
-
for (const [d, b] of Object.entries(
|
92
|
+
for (const [d, b] of Object.entries(c))
|
93
93
|
e = O(e, d, `this.$libs.${b}.${d}`);
|
94
94
|
for (const d of s)
|
95
95
|
e = O(e, d, `this.${d}`);
|
96
96
|
return e = e.replace(/_ctx\./g, "this."), e;
|
97
97
|
}
|
98
|
-
function
|
98
|
+
function v(e) {
|
99
99
|
return {
|
100
100
|
type: "JSExpression",
|
101
101
|
value: /^\{[\w\W]*\}$/.test(e) ? `(${e})` : e
|
@@ -191,14 +191,14 @@ var N;
|
|
191
191
|
function $(e) {
|
192
192
|
return e >= y.ZERO && e <= y.NINE;
|
193
193
|
}
|
194
|
-
function
|
194
|
+
function Xu(e) {
|
195
195
|
return e >= y.UPPER_A && e <= y.UPPER_F || e >= y.LOWER_A && e <= y.LOWER_F;
|
196
196
|
}
|
197
|
-
function
|
197
|
+
function zu(e) {
|
198
198
|
return e >= y.UPPER_A && e <= y.UPPER_Z || e >= y.LOWER_A && e <= y.LOWER_Z || $(e);
|
199
199
|
}
|
200
200
|
function Wu(e) {
|
201
|
-
return e === y.EQUALS ||
|
201
|
+
return e === y.EQUALS || zu(e);
|
202
202
|
}
|
203
203
|
var g;
|
204
204
|
(function(e) {
|
@@ -253,10 +253,10 @@ class Qu {
|
|
253
253
|
stateNumericStart(u, t) {
|
254
254
|
return t >= u.length ? -1 : (u.charCodeAt(t) | Ju) === y.LOWER_X ? (this.state = g.NumericHex, this.consumed += 1, this.stateNumericHex(u, t + 1)) : (this.state = g.NumericDecimal, this.stateNumericDecimal(u, t));
|
255
255
|
}
|
256
|
-
addToNumericResult(u, t, a,
|
256
|
+
addToNumericResult(u, t, a, i) {
|
257
257
|
if (t !== a) {
|
258
|
-
const
|
259
|
-
this.result = this.result * Math.pow(
|
258
|
+
const c = a - t;
|
259
|
+
this.result = this.result * Math.pow(i, c) + Number.parseInt(u.substr(t, c), i), this.consumed += c;
|
260
260
|
}
|
261
261
|
}
|
262
262
|
/**
|
@@ -271,11 +271,11 @@ class Qu {
|
|
271
271
|
stateNumericHex(u, t) {
|
272
272
|
const a = t;
|
273
273
|
for (; t < u.length; ) {
|
274
|
-
const
|
275
|
-
if ($(
|
274
|
+
const i = u.charCodeAt(t);
|
275
|
+
if ($(i) || Xu(i))
|
276
276
|
t += 1;
|
277
277
|
else
|
278
|
-
return this.addToNumericResult(u, a, t, 16), this.emitNumericEntity(
|
278
|
+
return this.addToNumericResult(u, a, t, 16), this.emitNumericEntity(i, 3);
|
279
279
|
}
|
280
280
|
return this.addToNumericResult(u, a, t, 16), -1;
|
281
281
|
}
|
@@ -291,11 +291,11 @@ class Qu {
|
|
291
291
|
stateNumericDecimal(u, t) {
|
292
292
|
const a = t;
|
293
293
|
for (; t < u.length; ) {
|
294
|
-
const
|
295
|
-
if ($(
|
294
|
+
const i = u.charCodeAt(t);
|
295
|
+
if ($(i))
|
296
296
|
t += 1;
|
297
297
|
else
|
298
|
-
return this.addToNumericResult(u, a, t, 10), this.emitNumericEntity(
|
298
|
+
return this.addToNumericResult(u, a, t, 10), this.emitNumericEntity(i, 2);
|
299
299
|
}
|
300
300
|
return this.addToNumericResult(u, a, t, 10), -1;
|
301
301
|
}
|
@@ -333,17 +333,17 @@ class Qu {
|
|
333
333
|
*/
|
334
334
|
stateNamedEntity(u, t) {
|
335
335
|
const { decodeTree: a } = this;
|
336
|
-
let
|
336
|
+
let i = a[this.treeIndex], c = (i & N.VALUE_LENGTH) >> 14;
|
337
337
|
for (; t < u.length; t++, this.excess++) {
|
338
338
|
const s = u.charCodeAt(t);
|
339
|
-
if (this.treeIndex = Zu(a,
|
339
|
+
if (this.treeIndex = Zu(a, i, this.treeIndex + Math.max(1, c), s), this.treeIndex < 0)
|
340
340
|
return this.result === 0 || // If we are parsing an attribute
|
341
341
|
this.decodeMode === A.Attribute && // We shouldn't have consumed any characters after the entity,
|
342
|
-
(
|
342
|
+
(c === 0 || // And there should be no invalid characters.
|
343
343
|
Wu(s)) ? 0 : this.emitNotTerminatedNamedEntity();
|
344
|
-
if (
|
344
|
+
if (i = a[this.treeIndex], c = (i & N.VALUE_LENGTH) >> 14, c !== 0) {
|
345
345
|
if (s === y.SEMI)
|
346
|
-
return this.emitNamedEntityData(this.treeIndex,
|
346
|
+
return this.emitNamedEntityData(this.treeIndex, c, this.consumed + this.excess);
|
347
347
|
this.decodeMode !== A.Strict && (this.result = this.treeIndex, this.consumed += this.excess, this.excess = 0);
|
348
348
|
}
|
349
349
|
}
|
@@ -356,8 +356,8 @@ class Qu {
|
|
356
356
|
*/
|
357
357
|
emitNotTerminatedNamedEntity() {
|
358
358
|
var u;
|
359
|
-
const { result: t, decodeTree: a } = this,
|
360
|
-
return this.emitNamedEntityData(t,
|
359
|
+
const { result: t, decodeTree: a } = this, i = (a[t] & N.VALUE_LENGTH) >> 14;
|
360
|
+
return this.emitNamedEntityData(t, i, this.consumed), (u = this.errors) === null || u === void 0 || u.missingSemicolonAfterCharacterReference(), this.consumed;
|
361
361
|
}
|
362
362
|
/**
|
363
363
|
* Emit a named entity.
|
@@ -369,8 +369,8 @@ class Qu {
|
|
369
369
|
* @returns The number of characters consumed.
|
370
370
|
*/
|
371
371
|
emitNamedEntityData(u, t, a) {
|
372
|
-
const { decodeTree:
|
373
|
-
return this.emitCodePoint(t === 1 ?
|
372
|
+
const { decodeTree: i } = this;
|
373
|
+
return this.emitCodePoint(t === 1 ? i[u] & ~N.VALUE_LENGTH : i[u + 1], a), t === 3 && this.emitCodePoint(i[u + 2], a), a;
|
374
374
|
}
|
375
375
|
/**
|
376
376
|
* Signal to the parser that the end of the input was reached.
|
@@ -397,14 +397,14 @@ class Qu {
|
|
397
397
|
}
|
398
398
|
}
|
399
399
|
function Zu(e, u, t, a) {
|
400
|
-
const
|
401
|
-
if (
|
402
|
-
return
|
403
|
-
if (
|
404
|
-
const d = a -
|
405
|
-
return d < 0 || d >=
|
406
|
-
}
|
407
|
-
let s = t, n = s +
|
400
|
+
const i = (u & N.BRANCH_LENGTH) >> 7, c = u & N.JUMP_TABLE;
|
401
|
+
if (i === 0)
|
402
|
+
return c !== 0 && a === c ? t : -1;
|
403
|
+
if (c) {
|
404
|
+
const d = a - c;
|
405
|
+
return d < 0 || d >= i ? -1 : e[t + d] - 1;
|
406
|
+
}
|
407
|
+
let s = t, n = s + i - 1;
|
408
408
|
for (; s <= n; ) {
|
409
409
|
const d = s + n >>> 1, b = e[d];
|
410
410
|
if (b < a)
|
@@ -412,7 +412,7 @@ function Zu(e, u, t, a) {
|
|
412
412
|
else if (b > a)
|
413
413
|
n = d - 1;
|
414
414
|
else
|
415
|
-
return e[d +
|
415
|
+
return e[d + i];
|
416
416
|
}
|
417
417
|
return -1;
|
418
418
|
}
|
@@ -437,7 +437,7 @@ var T;
|
|
437
437
|
(function(e) {
|
438
438
|
e[e.NoValue = 0] = "NoValue", e[e.Unquoted = 1] = "Unquoted", e[e.Single = 2] = "Single", e[e.Double = 3] = "Double";
|
439
439
|
})(T || (T = {}));
|
440
|
-
const
|
440
|
+
const x = {
|
441
441
|
Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
|
442
442
|
// CDATA[
|
443
443
|
CdataEnd: new Uint8Array([93, 93, 62]),
|
@@ -468,7 +468,7 @@ const p = {
|
|
468
468
|
};
|
469
469
|
class Yu {
|
470
470
|
constructor({ xmlMode: u = !1, decodeEntities: t = !0 }, a) {
|
471
|
-
this.cbs = a, this.state = r.Text, this.buffer = "", this.sectionStart = 0, this.index = 0, this.entityStart = 0, this.baseState = r.Text, this.isSpecial = !1, this.running = !0, this.offset = 0, this.currentSequence = void 0, this.sequenceIndex = 0, this.xmlMode = u, this.decodeEntities = t, this.entityDecoder = new Qu(u ? Hu : ju, (
|
471
|
+
this.cbs = a, this.state = r.Text, this.buffer = "", this.sectionStart = 0, this.index = 0, this.entityStart = 0, this.baseState = r.Text, this.isSpecial = !1, this.running = !0, this.offset = 0, this.currentSequence = void 0, this.sequenceIndex = 0, this.xmlMode = u, this.decodeEntities = t, this.entityDecoder = new Qu(u ? Hu : ju, (i, c) => this.emitCodePoint(i, c));
|
472
472
|
}
|
473
473
|
reset() {
|
474
474
|
this.state = r.Text, this.buffer = "", this.sectionStart = 0, this.index = 0, this.baseState = r.Text, this.currentSequence = void 0, this.running = !0, this.offset = 0;
|
@@ -518,10 +518,10 @@ class Yu {
|
|
518
518
|
}
|
519
519
|
this.sequenceIndex = 0;
|
520
520
|
}
|
521
|
-
(u | 32) === this.currentSequence[this.sequenceIndex] ? this.sequenceIndex += 1 : this.sequenceIndex === 0 ? this.currentSequence ===
|
521
|
+
(u | 32) === this.currentSequence[this.sequenceIndex] ? this.sequenceIndex += 1 : this.sequenceIndex === 0 ? this.currentSequence === x.TitleEnd ? this.decodeEntities && u === f.Amp && this.startEntity() : this.fastForwardTo(f.Lt) && (this.sequenceIndex = 1) : this.sequenceIndex = +(u === f.Lt);
|
522
522
|
}
|
523
523
|
stateCDATASequence(u) {
|
524
|
-
u ===
|
524
|
+
u === x.Cdata[this.sequenceIndex] ? ++this.sequenceIndex === x.Cdata.length && (this.state = r.InCommentLike, this.currentSequence = x.CdataEnd, this.sequenceIndex = 0, this.sectionStart = this.index + 1) : (this.sequenceIndex = 0, this.state = r.InDeclaration, this.stateInDeclaration(u));
|
525
525
|
}
|
526
526
|
/**
|
527
527
|
* When we wait for one specific character, we can speed things up
|
@@ -544,7 +544,7 @@ class Yu {
|
|
544
544
|
* - All characters but the start character of the sequence can be skipped.
|
545
545
|
*/
|
546
546
|
stateInCommentLike(u) {
|
547
|
-
u === this.currentSequence[this.sequenceIndex] ? ++this.sequenceIndex === this.currentSequence.length && (this.currentSequence ===
|
547
|
+
u === this.currentSequence[this.sequenceIndex] ? ++this.sequenceIndex === this.currentSequence.length && (this.currentSequence === x.CdataEnd ? this.cbs.oncdata(this.sectionStart, this.index, 2) : this.cbs.oncomment(this.sectionStart, this.index, 2), this.sequenceIndex = 0, this.sectionStart = this.index + 1, this.state = r.Text) : this.sequenceIndex === 0 ? this.fastForwardTo(this.currentSequence[0]) && (this.sequenceIndex = 1) : u !== this.currentSequence[this.sequenceIndex - 1] && (this.sequenceIndex = 0);
|
548
548
|
}
|
549
549
|
/**
|
550
550
|
* HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
|
@@ -565,7 +565,7 @@ class Yu {
|
|
565
565
|
this.state = r.InProcessingInstruction, this.sectionStart = this.index + 1;
|
566
566
|
else if (this.isTagStartChar(u)) {
|
567
567
|
const t = u | 32;
|
568
|
-
this.sectionStart = this.index, this.xmlMode ? this.state = r.InTagName : t ===
|
568
|
+
this.sectionStart = this.index, this.xmlMode ? this.state = r.InTagName : t === x.ScriptEnd[2] ? this.state = r.BeforeSpecialS : t === x.TitleEnd[2] || t === x.XmpEnd[2] ? this.state = r.BeforeSpecialT : this.state = r.InTagName;
|
569
569
|
} else u === f.Slash ? this.state = r.BeforeClosingTagName : (this.state = r.Text, this.stateText(u));
|
570
570
|
}
|
571
571
|
stateInTagName(u) {
|
@@ -617,27 +617,27 @@ class Yu {
|
|
617
617
|
(u === f.Gt || this.fastForwardTo(f.Gt)) && (this.cbs.onprocessinginstruction(this.sectionStart, this.index), this.state = r.Text, this.sectionStart = this.index + 1);
|
618
618
|
}
|
619
619
|
stateBeforeComment(u) {
|
620
|
-
u === f.Dash ? (this.state = r.InCommentLike, this.currentSequence =
|
620
|
+
u === f.Dash ? (this.state = r.InCommentLike, this.currentSequence = x.CommentEnd, this.sequenceIndex = 2, this.sectionStart = this.index + 1) : this.state = r.InDeclaration;
|
621
621
|
}
|
622
622
|
stateInSpecialComment(u) {
|
623
623
|
(u === f.Gt || this.fastForwardTo(f.Gt)) && (this.cbs.oncomment(this.sectionStart, this.index, 0), this.state = r.Text, this.sectionStart = this.index + 1);
|
624
624
|
}
|
625
625
|
stateBeforeSpecialS(u) {
|
626
626
|
const t = u | 32;
|
627
|
-
t ===
|
627
|
+
t === x.ScriptEnd[3] ? this.startSpecial(x.ScriptEnd, 4) : t === x.StyleEnd[3] ? this.startSpecial(x.StyleEnd, 4) : (this.state = r.InTagName, this.stateInTagName(u));
|
628
628
|
}
|
629
629
|
stateBeforeSpecialT(u) {
|
630
630
|
switch (u | 32) {
|
631
|
-
case
|
632
|
-
this.startSpecial(
|
631
|
+
case x.TitleEnd[3]: {
|
632
|
+
this.startSpecial(x.TitleEnd, 4);
|
633
633
|
break;
|
634
634
|
}
|
635
|
-
case
|
636
|
-
this.startSpecial(
|
635
|
+
case x.TextareaEnd[3]: {
|
636
|
+
this.startSpecial(x.TextareaEnd, 4);
|
637
637
|
break;
|
638
638
|
}
|
639
|
-
case
|
640
|
-
this.startSpecial(
|
639
|
+
case x.XmpEnd[3]: {
|
640
|
+
this.startSpecial(x.XmpEnd, 4);
|
641
641
|
break;
|
642
642
|
}
|
643
643
|
default:
|
@@ -784,7 +784,7 @@ class Yu {
|
|
784
784
|
/** Handle any trailing data. */
|
785
785
|
handleTrailingData() {
|
786
786
|
const u = this.buffer.length + this.offset;
|
787
|
-
this.sectionStart >= u || (this.state === r.InCommentLike ? this.currentSequence ===
|
787
|
+
this.sectionStart >= u || (this.state === r.InCommentLike ? this.currentSequence === x.CdataEnd ? this.cbs.oncdata(this.sectionStart, u, 0) : this.cbs.oncomment(this.sectionStart, u, 0) : this.state === r.InTagName || this.state === r.BeforeAttributeName || this.state === r.BeforeAttributeValue || this.state === r.AfterAttributeName || this.state === r.InAttributeName || this.state === r.InAttributeValueSq || this.state === r.InAttributeValueDq || this.state === r.InAttributeValueNq || this.state === r.InClosingTagName || this.cbs.ontext(this.sectionStart, u));
|
788
788
|
}
|
789
789
|
emitCodePoint(u, t) {
|
790
790
|
this.baseState !== r.Text && this.baseState !== r.InSpecialTag ? (this.sectionStart < this.entityStart && this.cbs.onattribdata(this.sectionStart, this.entityStart), this.sectionStart = this.entityStart + t, this.index = this.sectionStart - 1, this.cbs.onattribentity(u)) : (this.sectionStart < this.entityStart && this.cbs.ontext(this.sectionStart, this.entityStart), this.sectionStart = this.entityStart + t, this.index = this.sectionStart - 1, this.cbs.ontextentity(u, this.sectionStart));
|
@@ -798,19 +798,19 @@ const k = /* @__PURE__ */ new Set([
|
|
798
798
|
"button",
|
799
799
|
"datalist",
|
800
800
|
"textarea"
|
801
|
-
]),
|
801
|
+
]), m = /* @__PURE__ */ new Set(["p"]), Y = /* @__PURE__ */ new Set(["thead", "tbody"]), uu = /* @__PURE__ */ new Set(["dd", "dt"]), eu = /* @__PURE__ */ new Set(["rt", "rp"]), u0 = /* @__PURE__ */ new Map([
|
802
802
|
["tr", /* @__PURE__ */ new Set(["tr", "th", "td"])],
|
803
803
|
["th", /* @__PURE__ */ new Set(["th"])],
|
804
804
|
["td", /* @__PURE__ */ new Set(["thead", "th", "td"])],
|
805
805
|
["body", /* @__PURE__ */ new Set(["head", "link", "script"])],
|
806
806
|
["li", /* @__PURE__ */ new Set(["li"])],
|
807
|
-
["p",
|
808
|
-
["h1",
|
809
|
-
["h2",
|
810
|
-
["h3",
|
811
|
-
["h4",
|
812
|
-
["h5",
|
813
|
-
["h6",
|
807
|
+
["p", m],
|
808
|
+
["h1", m],
|
809
|
+
["h2", m],
|
810
|
+
["h3", m],
|
811
|
+
["h4", m],
|
812
|
+
["h5", m],
|
813
|
+
["h6", m],
|
814
814
|
["select", k],
|
815
815
|
["input", k],
|
816
816
|
["output", k],
|
@@ -821,27 +821,27 @@ const k = /* @__PURE__ */ new Set([
|
|
821
821
|
["optgroup", /* @__PURE__ */ new Set(["optgroup", "option"])],
|
822
822
|
["dd", uu],
|
823
823
|
["dt", uu],
|
824
|
-
["address",
|
825
|
-
["article",
|
826
|
-
["aside",
|
827
|
-
["blockquote",
|
828
|
-
["details",
|
829
|
-
["div",
|
830
|
-
["dl",
|
831
|
-
["fieldset",
|
832
|
-
["figcaption",
|
833
|
-
["figure",
|
834
|
-
["footer",
|
835
|
-
["form",
|
836
|
-
["header",
|
837
|
-
["hr",
|
838
|
-
["main",
|
839
|
-
["nav",
|
840
|
-
["ol",
|
841
|
-
["pre",
|
842
|
-
["section",
|
843
|
-
["table",
|
844
|
-
["ul",
|
824
|
+
["address", m],
|
825
|
+
["article", m],
|
826
|
+
["aside", m],
|
827
|
+
["blockquote", m],
|
828
|
+
["details", m],
|
829
|
+
["div", m],
|
830
|
+
["dl", m],
|
831
|
+
["fieldset", m],
|
832
|
+
["figcaption", m],
|
833
|
+
["figure", m],
|
834
|
+
["footer", m],
|
835
|
+
["form", m],
|
836
|
+
["header", m],
|
837
|
+
["hr", m],
|
838
|
+
["main", m],
|
839
|
+
["nav", m],
|
840
|
+
["ol", m],
|
841
|
+
["pre", m],
|
842
|
+
["section", m],
|
843
|
+
["table", m],
|
844
|
+
["ul", m],
|
845
845
|
["rt", eu],
|
846
846
|
["rp", eu],
|
847
847
|
["tbody", Y],
|
@@ -879,20 +879,20 @@ const k = /* @__PURE__ */ new Set([
|
|
879
879
|
]), t0 = /\s|\//;
|
880
880
|
class a0 {
|
881
881
|
constructor(u, t = {}) {
|
882
|
-
var a,
|
883
|
-
this.options = t, this.startIndex = 0, this.endIndex = 0, this.openTagStart = 0, this.tagname = "", this.attribname = "", this.attribvalue = "", this.attribs = null, this.stack = [], this.buffers = [], this.bufferOffset = 0, this.writeIndex = 0, this.ended = !1, this.cbs = u ?? {}, this.htmlMode = !this.options.xmlMode, this.lowerCaseTagNames = (a = t.lowerCaseTags) !== null && a !== void 0 ? a : this.htmlMode, this.lowerCaseAttributeNames = (
|
882
|
+
var a, i, c, s, n, d;
|
883
|
+
this.options = t, this.startIndex = 0, this.endIndex = 0, this.openTagStart = 0, this.tagname = "", this.attribname = "", this.attribvalue = "", this.attribs = null, this.stack = [], this.buffers = [], this.bufferOffset = 0, this.writeIndex = 0, this.ended = !1, this.cbs = u ?? {}, this.htmlMode = !this.options.xmlMode, this.lowerCaseTagNames = (a = t.lowerCaseTags) !== null && a !== void 0 ? a : this.htmlMode, this.lowerCaseAttributeNames = (i = t.lowerCaseAttributeNames) !== null && i !== void 0 ? i : this.htmlMode, this.recognizeSelfClosing = (c = t.recognizeSelfClosing) !== null && c !== void 0 ? c : !this.htmlMode, this.tokenizer = new ((s = t.Tokenizer) !== null && s !== void 0 ? s : Yu)(this.options, this), this.foreignContext = [!this.htmlMode], (d = (n = this.cbs).onparserinit) === null || d === void 0 || d.call(n, this);
|
884
884
|
}
|
885
885
|
// Tokenizer event handlers
|
886
886
|
/** @internal */
|
887
887
|
ontext(u, t) {
|
888
|
-
var a,
|
889
|
-
const
|
890
|
-
this.endIndex = t - 1, (
|
888
|
+
var a, i;
|
889
|
+
const c = this.getSlice(u, t);
|
890
|
+
this.endIndex = t - 1, (i = (a = this.cbs).ontext) === null || i === void 0 || i.call(a, c), this.startIndex = t;
|
891
891
|
}
|
892
892
|
/** @internal */
|
893
893
|
ontextentity(u, t) {
|
894
|
-
var a,
|
895
|
-
this.endIndex = t - 1, (
|
894
|
+
var a, i;
|
895
|
+
this.endIndex = t - 1, (i = (a = this.cbs).ontext) === null || i === void 0 || i.call(a, K(u)), this.startIndex = t;
|
896
896
|
}
|
897
897
|
/**
|
898
898
|
* Checks if the current tag is a void element. Override this if you want
|
@@ -908,7 +908,7 @@ class a0 {
|
|
908
908
|
this.lowerCaseTagNames && (a = a.toLowerCase()), this.emitOpenTag(a);
|
909
909
|
}
|
910
910
|
emitOpenTag(u) {
|
911
|
-
var t, a,
|
911
|
+
var t, a, i, c;
|
912
912
|
this.openTagStart = this.startIndex, this.tagname = u;
|
913
913
|
const s = this.htmlMode && u0.get(u);
|
914
914
|
if (s)
|
@@ -916,7 +916,7 @@ class a0 {
|
|
916
916
|
const n = this.stack.shift();
|
917
917
|
(a = (t = this.cbs).onclosetag) === null || a === void 0 || a.call(t, n, !0);
|
918
918
|
}
|
919
|
-
this.isVoidElement(u) || (this.stack.unshift(u), this.htmlMode && (tu.has(u) ? this.foreignContext.unshift(!0) : au.has(u) && this.foreignContext.unshift(!1))), (
|
919
|
+
this.isVoidElement(u) || (this.stack.unshift(u), this.htmlMode && (tu.has(u) ? this.foreignContext.unshift(!0) : au.has(u) && this.foreignContext.unshift(!1))), (c = (i = this.cbs).onopentagname) === null || c === void 0 || c.call(i, u), this.cbs.onopentag && (this.attribs = {});
|
920
920
|
}
|
921
921
|
endOpenTag(u) {
|
922
922
|
var t, a;
|
@@ -928,17 +928,17 @@ class a0 {
|
|
928
928
|
}
|
929
929
|
/** @internal */
|
930
930
|
onclosetag(u, t) {
|
931
|
-
var a,
|
931
|
+
var a, i, c, s, n, d, b, h;
|
932
932
|
this.endIndex = t;
|
933
933
|
let o = this.getSlice(u, t);
|
934
934
|
if (this.lowerCaseTagNames && (o = o.toLowerCase()), this.htmlMode && (tu.has(o) || au.has(o)) && this.foreignContext.shift(), this.isVoidElement(o))
|
935
|
-
this.htmlMode && o === "br" && ((s = (
|
935
|
+
this.htmlMode && o === "br" && ((s = (c = this.cbs).onopentagname) === null || s === void 0 || s.call(c, "br"), (d = (n = this.cbs).onopentag) === null || d === void 0 || d.call(n, "br", {}, !0), (h = (b = this.cbs).onclosetag) === null || h === void 0 || h.call(b, "br", !1));
|
936
936
|
else {
|
937
937
|
const S = this.stack.indexOf(o);
|
938
938
|
if (S !== -1)
|
939
|
-
for (let
|
940
|
-
const
|
941
|
-
(
|
939
|
+
for (let p = 0; p <= S; p++) {
|
940
|
+
const E = this.stack.shift();
|
941
|
+
(i = (a = this.cbs).onclosetag) === null || i === void 0 || i.call(a, E, p !== S);
|
942
942
|
}
|
943
943
|
else this.htmlMode && o === "p" && (this.emitOpenTag("p"), this.closeCurrentTag(!0));
|
944
944
|
}
|
@@ -950,8 +950,8 @@ class a0 {
|
|
950
950
|
}
|
951
951
|
closeCurrentTag(u) {
|
952
952
|
var t, a;
|
953
|
-
const
|
954
|
-
this.endOpenTag(u), this.stack[0] ===
|
953
|
+
const i = this.tagname;
|
954
|
+
this.endOpenTag(u), this.stack[0] === i && ((a = (t = this.cbs).onclosetag) === null || a === void 0 || a.call(t, i, !u), this.stack.shift());
|
955
955
|
}
|
956
956
|
/** @internal */
|
957
957
|
onattribname(u, t) {
|
@@ -969,8 +969,8 @@ class a0 {
|
|
969
969
|
}
|
970
970
|
/** @internal */
|
971
971
|
onattribend(u, t) {
|
972
|
-
var a,
|
973
|
-
this.endIndex = t, (
|
972
|
+
var a, i;
|
973
|
+
this.endIndex = t, (i = (a = this.cbs).onattribute) === null || i === void 0 || i.call(a, this.attribname, this.attribvalue, u === T.Double ? '"' : u === T.Single ? "'" : u === T.NoValue ? void 0 : null), this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname) && (this.attribs[this.attribname] = this.attribvalue), this.attribvalue = "";
|
974
974
|
}
|
975
975
|
getInstructionName(u) {
|
976
976
|
const t = u.search(t0);
|
@@ -982,8 +982,8 @@ class a0 {
|
|
982
982
|
this.endIndex = t;
|
983
983
|
const a = this.getSlice(u, t);
|
984
984
|
if (this.cbs.onprocessinginstruction) {
|
985
|
-
const
|
986
|
-
this.cbs.onprocessinginstruction(`!${
|
985
|
+
const i = this.getInstructionName(a);
|
986
|
+
this.cbs.onprocessinginstruction(`!${i}`, `!${a}`);
|
987
987
|
}
|
988
988
|
this.startIndex = t + 1;
|
989
989
|
}
|
@@ -992,22 +992,22 @@ class a0 {
|
|
992
992
|
this.endIndex = t;
|
993
993
|
const a = this.getSlice(u, t);
|
994
994
|
if (this.cbs.onprocessinginstruction) {
|
995
|
-
const
|
996
|
-
this.cbs.onprocessinginstruction(`?${
|
995
|
+
const i = this.getInstructionName(a);
|
996
|
+
this.cbs.onprocessinginstruction(`?${i}`, `?${a}`);
|
997
997
|
}
|
998
998
|
this.startIndex = t + 1;
|
999
999
|
}
|
1000
1000
|
/** @internal */
|
1001
1001
|
oncomment(u, t, a) {
|
1002
|
-
var
|
1003
|
-
this.endIndex = t, (
|
1002
|
+
var i, c, s, n;
|
1003
|
+
this.endIndex = t, (c = (i = this.cbs).oncomment) === null || c === void 0 || c.call(i, this.getSlice(u, t - a)), (n = (s = this.cbs).oncommentend) === null || n === void 0 || n.call(s), this.startIndex = t + 1;
|
1004
1004
|
}
|
1005
1005
|
/** @internal */
|
1006
1006
|
oncdata(u, t, a) {
|
1007
|
-
var
|
1007
|
+
var i, c, s, n, d, b, h, o, S, p;
|
1008
1008
|
this.endIndex = t;
|
1009
|
-
const
|
1010
|
-
!this.htmlMode || this.options.recognizeCDATA ? ((
|
1009
|
+
const E = this.getSlice(u, t - a);
|
1010
|
+
!this.htmlMode || this.options.recognizeCDATA ? ((c = (i = this.cbs).oncdatastart) === null || c === void 0 || c.call(i), (n = (s = this.cbs).ontext) === null || n === void 0 || n.call(s, E), (b = (d = this.cbs).oncdataend) === null || b === void 0 || b.call(d)) : ((o = (h = this.cbs).oncomment) === null || o === void 0 || o.call(h, `[CDATA[${E}]]`), (p = (S = this.cbs).oncommentend) === null || p === void 0 || p.call(S)), this.startIndex = t + 1;
|
1011
1011
|
}
|
1012
1012
|
/** @internal */
|
1013
1013
|
onend() {
|
@@ -1023,8 +1023,8 @@ class a0 {
|
|
1023
1023
|
* Resets the parser to a blank state, ready to parse a new HTML document
|
1024
1024
|
*/
|
1025
1025
|
reset() {
|
1026
|
-
var u, t, a,
|
1027
|
-
(t = (u = this.cbs).onreset) === null || t === void 0 || t.call(u), this.tokenizer.reset(), this.tagname = "", this.attribname = "", this.attribs = null, this.stack.length = 0, this.startIndex = 0, this.endIndex = 0, (
|
1026
|
+
var u, t, a, i;
|
1027
|
+
(t = (u = this.cbs).onreset) === null || t === void 0 || t.call(u), this.tokenizer.reset(), this.tagname = "", this.attribname = "", this.attribs = null, this.stack.length = 0, this.startIndex = 0, this.endIndex = 0, (i = (a = this.cbs).onparserinit) === null || i === void 0 || i.call(a, this), this.buffers.length = 0, this.foreignContext.length = 0, this.foreignContext.unshift(!this.htmlMode), this.bufferOffset = 0, this.writeIndex = 0, this.ended = !1;
|
1028
1028
|
}
|
1029
1029
|
/**
|
1030
1030
|
* Resets the parser, then parses a complete document and
|
@@ -1105,49 +1105,53 @@ class a0 {
|
|
1105
1105
|
this.end(u);
|
1106
1106
|
}
|
1107
1107
|
}
|
1108
|
-
function
|
1109
|
-
|
1110
|
-
|
1108
|
+
function iu(e) {
|
1109
|
+
const u = { name: "", children: [] }, t = [u];
|
1110
|
+
let a = "";
|
1111
|
+
const i = new a0(
|
1111
1112
|
{
|
1112
|
-
onopentag: (c,
|
1113
|
-
const
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1113
|
+
onopentag: (c, s, n) => {
|
1114
|
+
const d = t[t.length - 1];
|
1115
|
+
a.trim() && (Array.isArray(d.children) ? d.children.push({
|
1116
|
+
name: "text",
|
1117
|
+
children: a.trim()
|
1118
|
+
}) : d.children = a.trim(), a = "");
|
1119
|
+
const b = Object.entries(s || {}).reduce(
|
1120
|
+
(o, S) => {
|
1121
|
+
let [p = "", E = ""] = S;
|
1122
|
+
return p = p.replace(/\\\"/g, ""), E = E.replace(/\\\"/g, ""), p && (o[p] = E), o;
|
1117
1123
|
},
|
1118
1124
|
{}
|
1119
|
-
),
|
1125
|
+
), h = {
|
1120
1126
|
name: c,
|
1121
|
-
props:
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1127
|
+
props: b
|
1128
|
+
};
|
1129
|
+
Array.isArray(d.children) ? d.children.push(h) : d.children = [
|
1130
|
+
{
|
1131
|
+
name: "span",
|
1132
|
+
children: d.children
|
1133
|
+
},
|
1134
|
+
h
|
1135
|
+
], n || t.push(h);
|
1125
1136
|
},
|
1126
1137
|
ontext: (c) => {
|
1127
|
-
const
|
1128
|
-
|
1129
|
-
const s = t[t.length - 1];
|
1130
|
-
s.children ? (s.children = [
|
1131
|
-
{
|
1132
|
-
name: "span",
|
1133
|
-
children: s.children
|
1134
|
-
}
|
1135
|
-
], s.children.push({
|
1136
|
-
name: "span",
|
1137
|
-
children: i
|
1138
|
-
})) : s.children = i;
|
1139
|
-
}
|
1138
|
+
const s = c.trim();
|
1139
|
+
s && s !== '"' && (a += s);
|
1140
1140
|
},
|
1141
1141
|
onclosetag: () => {
|
1142
|
-
t.pop();
|
1142
|
+
const c = t.pop();
|
1143
|
+
a.trim() && (Array.isArray(c?.children) ? c.children.push({
|
1144
|
+
name: "span",
|
1145
|
+
children: a.trim()
|
1146
|
+
}) : c && (c.children = a.trim()), a = "");
|
1143
1147
|
}
|
1144
1148
|
},
|
1145
|
-
{
|
1149
|
+
{ decodeEntities: !0 }
|
1146
1150
|
);
|
1147
|
-
return
|
1151
|
+
return i.write(e), i.end(), u.children || [];
|
1148
1152
|
}
|
1149
1153
|
let F = [], P = {}, du = {}, fu = {};
|
1150
|
-
function
|
1154
|
+
function i0(e, u, t = "", a) {
|
1151
1155
|
return F = [], P = {}, du = a?.handlers || {}, fu = a?.styles || {}, {
|
1152
1156
|
nodes: (ku({
|
1153
1157
|
id: e,
|
@@ -1160,12 +1164,12 @@ function c0(e, u, t = "", a) {
|
|
1160
1164
|
context: P
|
1161
1165
|
};
|
1162
1166
|
}
|
1163
|
-
function
|
1167
|
+
function c0(e) {
|
1164
1168
|
if (e.name === "slot") {
|
1165
1169
|
let u = "default";
|
1166
1170
|
const t = [];
|
1167
|
-
for (const [a,
|
1168
|
-
a === "name" ? u =
|
1171
|
+
for (const [a, i] of Object.entries(e.props || {}))
|
1172
|
+
a === "name" ? u = i : t.push(a);
|
1169
1173
|
F.push({
|
1170
1174
|
name: u,
|
1171
1175
|
params: t
|
@@ -1174,8 +1178,8 @@ function i0(e) {
|
|
1174
1178
|
}
|
1175
1179
|
function s0(e) {
|
1176
1180
|
return e.replace(/\s+/g, " ").split(";").reduce((t, a) => {
|
1177
|
-
const [
|
1178
|
-
return
|
1181
|
+
const [i, c] = a.split(":").map((s) => s.trim());
|
1182
|
+
return i && c && (t[i] = c), t;
|
1179
1183
|
}, {});
|
1180
1184
|
}
|
1181
1185
|
function r0(e) {
|
@@ -1183,14 +1187,14 @@ function r0(e) {
|
|
1183
1187
|
for (const t of e) {
|
1184
1188
|
if (t.type === l.ATTRIBUTE)
|
1185
1189
|
if (t.name === "class") {
|
1186
|
-
const a = t.value?.content || "",
|
1190
|
+
const a = t.value?.content || "", i = /[\w]+_[\w]{5,}/, c = a.match(i)?.[0] || "", s = a.split(" ").filter((d) => d !== c), n = fu[`.${c}`];
|
1187
1191
|
n && (u.style = n), s.length && (u.class = s.join(" "));
|
1188
1192
|
} else if (t.name === "style") {
|
1189
1193
|
const a = t.value?.content || "";
|
1190
1194
|
a && (u.style = s0(a));
|
1191
1195
|
} else
|
1192
1196
|
u[t.name] = t.value?.content || "";
|
1193
|
-
t.type === l.DIRECTIVE && t.name === "bind" && (t.exp?.type === l.SIMPLE_EXPRESSION && t.arg?.type === l.SIMPLE_EXPRESSION && (u[t.arg.content] =
|
1197
|
+
t.type === l.DIRECTIVE && t.name === "bind" && (t.exp?.type === l.SIMPLE_EXPRESSION && t.arg?.type === l.SIMPLE_EXPRESSION && (u[t.arg.content] = v(`(${t.exp.content})`)), t.exp?.type === l.COMPOUND_EXPRESSION && t.arg?.type === l.SIMPLE_EXPRESSION && (u[t.arg.content] = v(`(${t.exp.loc.source})`)));
|
1194
1198
|
}
|
1195
1199
|
return u;
|
1196
1200
|
}
|
@@ -1198,25 +1202,25 @@ function n0(e, u = {}) {
|
|
1198
1202
|
const t = {};
|
1199
1203
|
for (const a of e)
|
1200
1204
|
if (a.type === l.DIRECTIVE && a.name === "on" && a.arg?.type === l.SIMPLE_EXPRESSION) {
|
1201
|
-
const
|
1202
|
-
(
|
1205
|
+
const i = a.modifiers.reduce(
|
1206
|
+
(h, o) => (h[o.content] = !0, h),
|
1203
1207
|
{}
|
1204
1208
|
);
|
1205
|
-
let
|
1206
|
-
/\)$/.test(
|
1207
|
-
const n = new RegExp(`${a.arg.content}_[\\w]{5,}`), d =
|
1209
|
+
let c = a.exp?.loc.source || "";
|
1210
|
+
/\)$/.test(c) && (c = `($event) => ${c}`);
|
1211
|
+
const n = new RegExp(`${a.arg.content}_[\\w]{5,}`), d = c.match(n)?.[0] || "", b = u[d];
|
1208
1212
|
if (d && b)
|
1209
1213
|
t[a.arg.content] = {
|
1210
1214
|
name: a.arg.content,
|
1211
1215
|
handler: b,
|
1212
|
-
modifiers:
|
1216
|
+
modifiers: i
|
1213
1217
|
};
|
1214
1218
|
else {
|
1215
|
-
const
|
1219
|
+
const h = a.exp?.ast?.type === "AssignmentExpression";
|
1216
1220
|
t[a.arg.content] = {
|
1217
1221
|
name: a.arg.content,
|
1218
|
-
handler: C(
|
1219
|
-
modifiers:
|
1222
|
+
handler: C(h ? `()=> {${c}}` : `(${c})`),
|
1223
|
+
modifiers: i
|
1220
1224
|
};
|
1221
1225
|
}
|
1222
1226
|
}
|
@@ -1228,12 +1232,12 @@ function d0(e) {
|
|
1228
1232
|
const t = e.codegenNode?.test;
|
1229
1233
|
t && u.push({
|
1230
1234
|
name: "vIf",
|
1231
|
-
value:
|
1235
|
+
value: v(t.loc.source)
|
1232
1236
|
});
|
1233
1237
|
}
|
1234
1238
|
if (e.type === l.FOR && u.push({
|
1235
1239
|
name: "vFor",
|
1236
|
-
value:
|
1240
|
+
value: v(e.source.loc.source),
|
1237
1241
|
iterator: {
|
1238
1242
|
item: e.valueAlias?.loc.source || "item",
|
1239
1243
|
index: e.keyAlias?.loc.source || "index"
|
@@ -1246,35 +1250,35 @@ function d0(e) {
|
|
1246
1250
|
u.push({
|
1247
1251
|
name: "vModel",
|
1248
1252
|
arg: n.arg?.content,
|
1249
|
-
value:
|
1253
|
+
value: v(n.exp?.loc.source || "")
|
1250
1254
|
});
|
1251
1255
|
});
|
1252
|
-
const
|
1253
|
-
|
1256
|
+
const i = t.find((n) => n.name === "show");
|
1257
|
+
i && u.push({
|
1254
1258
|
name: "vShow",
|
1255
|
-
value:
|
1259
|
+
value: v(i.exp?.loc.source || "")
|
1256
1260
|
});
|
1257
|
-
const
|
1258
|
-
|
1261
|
+
const c = t.find((n) => n.name === "bind" && !n.arg);
|
1262
|
+
c && u.push({
|
1259
1263
|
name: "vBind",
|
1260
|
-
value:
|
1264
|
+
value: v(c.exp?.loc.source || "")
|
1261
1265
|
});
|
1262
1266
|
const s = t.find((n) => n.name === "html");
|
1263
1267
|
s && u.push({
|
1264
1268
|
name: "vHtml",
|
1265
|
-
value:
|
1269
|
+
value: v(s.exp?.loc.source || "")
|
1266
1270
|
});
|
1267
1271
|
}
|
1268
1272
|
return u;
|
1269
1273
|
}
|
1270
1274
|
function ou(e) {
|
1271
1275
|
let u = "";
|
1272
|
-
const { name: t, props: a, events:
|
1273
|
-
if (typeof
|
1274
|
-
const s = new RegExp(`${t}_([\\w]+)`), n =
|
1276
|
+
const { name: t, props: a, events: i = {} } = e, c = a?.class || "";
|
1277
|
+
if (typeof c == "string") {
|
1278
|
+
const s = new RegExp(`${t}_([\\w]+)`), n = c.match(s);
|
1275
1279
|
n && n[1] && (u = n[1]);
|
1276
1280
|
}
|
1277
|
-
for (const { name: s, handler: n } of Object.values(
|
1281
|
+
for (const { name: s, handler: n } of Object.values(i)) {
|
1278
1282
|
const d = new RegExp(`${s}_([\\w]+)`), b = n.value.match(d);
|
1279
1283
|
b && b[1] && (u = b[1]);
|
1280
1284
|
}
|
@@ -1282,17 +1286,17 @@ function ou(e) {
|
|
1282
1286
|
}
|
1283
1287
|
function j(e, u) {
|
1284
1288
|
const t = new Set(u?.id ? P[u.id] : []), a = (e.directives || []).find((s) => s.name === "vFor");
|
1285
|
-
let
|
1289
|
+
let i = new Set(Array.from(t));
|
1286
1290
|
if (a) {
|
1287
1291
|
const { item: s = "item", index: n = "index" } = a.iterator || {};
|
1288
|
-
|
1292
|
+
i = /* @__PURE__ */ new Set([s, n, ...Array.from(i)]);
|
1289
1293
|
}
|
1290
|
-
const
|
1291
|
-
if (
|
1292
|
-
const s = typeof
|
1293
|
-
|
1294
|
+
const c = e.slot;
|
1295
|
+
if (c) {
|
1296
|
+
const s = typeof c == "string" ? [] : c.params || [], n = s.length ? s : [`scope_${u?.id}`];
|
1297
|
+
i = /* @__PURE__ */ new Set([...n, ...Array.from(i)]);
|
1294
1298
|
}
|
1295
|
-
P[e.id] =
|
1299
|
+
P[e.id] = i;
|
1296
1300
|
}
|
1297
1301
|
function U(e, u, t) {
|
1298
1302
|
const a = {
|
@@ -1302,8 +1306,8 @@ function U(e, u, t) {
|
|
1302
1306
|
directives: d0(t || e)
|
1303
1307
|
};
|
1304
1308
|
a.id = ou(a), j(a, u);
|
1305
|
-
const
|
1306
|
-
return j(a, u),
|
1309
|
+
const i = o0(a, e.children);
|
1310
|
+
return j(a, u), c0(i), i;
|
1307
1311
|
}
|
1308
1312
|
function D(e, u) {
|
1309
1313
|
if (e.type === l.ELEMENT)
|
@@ -1318,41 +1322,55 @@ function D(e, u) {
|
|
1318
1322
|
if (t.type === l.ELEMENT)
|
1319
1323
|
return U(t, u, e);
|
1320
1324
|
}
|
1321
|
-
return e.type === l.TEXT_CALL ? e.content.type == l.TEXT ? e.content.content : e.content.type === l.INTERPOLATION ?
|
1325
|
+
return e.type === l.TEXT_CALL ? e.content.type == l.TEXT ? e.content.content : e.content.type === l.INTERPOLATION ? v(e.content.content.loc.source) : "" : e.type === l.TEXT ? e.content : e.type === l.INTERPOLATION && (e.content.type === l.SIMPLE_EXPRESSION || e.content.type === l.COMPOUND_EXPRESSION) ? v(e.content.loc.source) : e.type === l.COMPOUND_EXPRESSION ? f0(
|
1326
|
+
e.children
|
1327
|
+
) : (console.warn("未处理", e.type), null);
|
1328
|
+
}
|
1329
|
+
function f0(e = []) {
|
1330
|
+
const u = e.filter((a) => typeof a != "string"), t = [];
|
1331
|
+
for (const a of u)
|
1332
|
+
t.push({
|
1333
|
+
name: "span",
|
1334
|
+
children: a.type === l.TEXT ? a.loc.source : v(a.content?.loc.source)
|
1335
|
+
});
|
1336
|
+
return {
|
1337
|
+
name: "span",
|
1338
|
+
children: t
|
1339
|
+
};
|
1322
1340
|
}
|
1323
|
-
function
|
1341
|
+
function o0(e, u = []) {
|
1324
1342
|
const t = [];
|
1325
1343
|
for (const a of u)
|
1326
1344
|
if (a.type === l.ELEMENT && a.codegenNode?.value?.arguments) {
|
1327
|
-
const
|
1328
|
-
if (
|
1329
|
-
const
|
1330
|
-
t.push(...
|
1345
|
+
const i = a.codegenNode.value.arguments[0];
|
1346
|
+
if (i) {
|
1347
|
+
const c = iu(i);
|
1348
|
+
t.push(...c);
|
1331
1349
|
}
|
1332
1350
|
} else if (a.type === l.ELEMENT && a.tag === "template") {
|
1333
|
-
const
|
1334
|
-
for (const
|
1335
|
-
const s =
|
1351
|
+
const i = a.props.find((c) => c.name === "slot");
|
1352
|
+
for (const c of a.children) {
|
1353
|
+
const s = c.type === l.TEXT || c.type === l.TEXT_CALL ? {
|
1336
1354
|
name: "span",
|
1337
|
-
children: D(
|
1338
|
-
} : D(
|
1339
|
-
s && (Vu(s) &&
|
1340
|
-
name:
|
1341
|
-
params:
|
1355
|
+
children: D(c, e)
|
1356
|
+
} : D(c, e);
|
1357
|
+
s && (Vu(s) && i?.type === l.DIRECTIVE && (s.id = ou(s), s.slot = {
|
1358
|
+
name: i.arg?.content || "default",
|
1359
|
+
params: i.exp?.identifiers || []
|
1342
1360
|
}, j(s, e)), t.push(s));
|
1343
1361
|
}
|
1344
1362
|
} else if (a.type === l.JS_CALL_EXPRESSION) {
|
1345
|
-
const
|
1346
|
-
if (
|
1347
|
-
const
|
1348
|
-
t.push(...
|
1363
|
+
const i = a.arguments?.[0];
|
1364
|
+
if (i) {
|
1365
|
+
const c = iu(i);
|
1366
|
+
t.push(...c);
|
1349
1367
|
}
|
1350
1368
|
} else if (a.type === l.TEXT_CALL) {
|
1351
|
-
const
|
1352
|
-
|
1369
|
+
const i = D(a, e);
|
1370
|
+
i && t.push(i);
|
1353
1371
|
} else {
|
1354
|
-
const
|
1355
|
-
|
1372
|
+
const i = D(a, e);
|
1373
|
+
i && t.push(i);
|
1356
1374
|
}
|
1357
1375
|
if (t.length === 1) {
|
1358
1376
|
const a = t[0];
|
@@ -1361,15 +1379,15 @@ function f0(e, u = []) {
|
|
1361
1379
|
e.children = t.map((a) => typeof a == "string" ? { name: "span", children: a } : a);
|
1362
1380
|
return e;
|
1363
1381
|
}
|
1364
|
-
function
|
1382
|
+
function b0(e, u) {
|
1365
1383
|
const a = {
|
1366
|
-
imports:
|
1384
|
+
imports: l0(e),
|
1367
1385
|
emits: [],
|
1368
1386
|
errors: []
|
1369
|
-
},
|
1370
|
-
return nu(
|
1371
|
-
ExportDefaultDeclaration(
|
1372
|
-
const s =
|
1387
|
+
}, i = ru(e);
|
1388
|
+
return nu(i, {
|
1389
|
+
ExportDefaultDeclaration(c) {
|
1390
|
+
const s = c.node.declaration;
|
1373
1391
|
if (s.type !== "CallExpression") return;
|
1374
1392
|
const n = s.arguments[0];
|
1375
1393
|
if (n?.type !== "ObjectExpression") return;
|
@@ -1377,63 +1395,63 @@ function o0(e, u) {
|
|
1377
1395
|
(o) => o.type === "ObjectProperty"
|
1378
1396
|
), b = n.properties.filter(
|
1379
1397
|
(o) => o.type == "ObjectMethod"
|
1380
|
-
),
|
1398
|
+
), h = d.find(
|
1381
1399
|
(o) => o.key.name === "computed"
|
1382
1400
|
);
|
1383
|
-
|
1401
|
+
h && (a.computed = bu(h.value), a.watchers = y0(h.value));
|
1384
1402
|
for (const o of d)
|
1385
1403
|
switch (o.key.name) {
|
1386
1404
|
case "name":
|
1387
1405
|
a.name = o.value.value;
|
1388
1406
|
break;
|
1389
1407
|
case "methods":
|
1390
|
-
a.handlers =
|
1408
|
+
a.handlers = g0(o.value), a.methods = x0(o.value), a.dataSources = p0(
|
1391
1409
|
o.value,
|
1392
1410
|
u
|
1393
1411
|
);
|
1394
1412
|
break;
|
1395
1413
|
case "watch":
|
1396
|
-
a.watch =
|
1414
|
+
a.watch = S0(
|
1397
1415
|
o.value,
|
1398
1416
|
a.watchers
|
1399
1417
|
);
|
1400
1418
|
break;
|
1401
1419
|
case "props":
|
1402
|
-
a.props =
|
1420
|
+
a.props = w0(o.value);
|
1403
1421
|
break;
|
1404
1422
|
case "inject":
|
1405
|
-
a.inject =
|
1423
|
+
a.inject = T0(o.value);
|
1406
1424
|
break;
|
1407
1425
|
}
|
1408
1426
|
for (const o of b)
|
1409
1427
|
switch (o.key.name) {
|
1410
1428
|
case "setup":
|
1411
|
-
a.state =
|
1429
|
+
a.state = m0(o.body);
|
1412
1430
|
break;
|
1413
1431
|
}
|
1414
|
-
a.lifeCycles =
|
1432
|
+
a.lifeCycles = E0(b);
|
1415
1433
|
},
|
1416
|
-
CallExpression(
|
1417
|
-
const s =
|
1434
|
+
CallExpression(c) {
|
1435
|
+
const s = A0(c.node);
|
1418
1436
|
if (s.length)
|
1419
1437
|
for (let n of s)
|
1420
1438
|
a.emits?.find((b) => b.name === n.name) || a.emits?.push(n);
|
1421
1439
|
}
|
1422
1440
|
}), a;
|
1423
1441
|
}
|
1424
|
-
function
|
1442
|
+
function l0(e) {
|
1425
1443
|
const u = /import\s+{(.+?)}\s+from\s+['"](.+?)['"]/g, t = [];
|
1426
1444
|
let a;
|
1427
1445
|
for (; (a = u.exec(e)) !== null; ) {
|
1428
|
-
const
|
1446
|
+
const i = a[2] === "@element-plus/icons-vue" ? "@vtj/icons" : a[2];
|
1429
1447
|
t.push({
|
1430
|
-
from:
|
1431
|
-
imports: a[1].split(",").map((
|
1448
|
+
from: i,
|
1449
|
+
imports: a[1].split(",").map((c) => c.trim())
|
1432
1450
|
});
|
1433
1451
|
}
|
1434
1452
|
return t;
|
1435
1453
|
}
|
1436
|
-
function
|
1454
|
+
function h0(e) {
|
1437
1455
|
for (const u of e.body)
|
1438
1456
|
if (u.type === "VariableDeclaration" && u.kind == "const") {
|
1439
1457
|
const { id: t, init: a } = u.declarations[0];
|
@@ -1442,26 +1460,26 @@ function l0(e) {
|
|
1442
1460
|
}
|
1443
1461
|
return null;
|
1444
1462
|
}
|
1445
|
-
function
|
1446
|
-
const u =
|
1463
|
+
function m0(e) {
|
1464
|
+
const u = h0(e);
|
1447
1465
|
if (!u) return {};
|
1448
1466
|
const t = {};
|
1449
1467
|
for (const a of u.properties) {
|
1450
|
-
const { key:
|
1451
|
-
if (
|
1452
|
-
const s = R(
|
1453
|
-
t[
|
1468
|
+
const { key: i, value: c } = a;
|
1469
|
+
if (i.type === "Identifier") {
|
1470
|
+
const s = R(c);
|
1471
|
+
t[i.name] = v(s);
|
1454
1472
|
}
|
1455
1473
|
}
|
1456
1474
|
return t;
|
1457
1475
|
}
|
1458
1476
|
function q(e) {
|
1459
|
-
const { key: u, async: t, params: a, body:
|
1477
|
+
const { key: u, async: t, params: a, body: i } = e, c = a.map((s) => s.type === "ObjectPattern" ? `{${s.properties.map((d) => d.key?.name || d.name).join(",")}}` : s.name).join(", ");
|
1460
1478
|
if (u.type === "Identifier") {
|
1461
|
-
const s = u.name, n = R(
|
1479
|
+
const s = u.name, n = R(i), b = `${t ? "async " : ""}(${c}) => ${n}`, h = s.startsWith("watcher_");
|
1462
1480
|
return {
|
1463
1481
|
name: s,
|
1464
|
-
watcher:
|
1482
|
+
watcher: h,
|
1465
1483
|
exp: C(b)
|
1466
1484
|
};
|
1467
1485
|
}
|
@@ -1475,17 +1493,17 @@ function bu(e) {
|
|
1475
1493
|
}
|
1476
1494
|
return u;
|
1477
1495
|
}
|
1478
|
-
function
|
1496
|
+
function p0(e, u) {
|
1479
1497
|
if (!e) return {};
|
1480
|
-
const t = {}, a = /apis\[\'([\w]*)\'\]/,
|
1481
|
-
for (const
|
1482
|
-
const s = q(
|
1498
|
+
const t = {}, a = /apis\[\'([\w]*)\'\]/, i = /\.then\(([\w\W]*)\)/;
|
1499
|
+
for (const c of e.properties) {
|
1500
|
+
const s = q(c);
|
1483
1501
|
if (s && s.exp.value.includes("provider.apis")) {
|
1484
1502
|
const d = (s.exp.value.match(a) || [])[1];
|
1485
1503
|
if (!d) continue;
|
1486
|
-
const b =
|
1504
|
+
const b = I0(u, d);
|
1487
1505
|
if (!b) continue;
|
1488
|
-
const
|
1506
|
+
const h = s.exp.value.match(i)?.[1];
|
1489
1507
|
t[s.name] = {
|
1490
1508
|
ref: d,
|
1491
1509
|
name: b.name,
|
@@ -1499,7 +1517,7 @@ function m0(e, u) {
|
|
1499
1517
|
label: b.label,
|
1500
1518
|
transform: {
|
1501
1519
|
type: "JSFunction",
|
1502
|
-
value:
|
1520
|
+
value: h || `(res) => {
|
1503
1521
|
return res;
|
1504
1522
|
}`
|
1505
1523
|
},
|
@@ -1511,31 +1529,31 @@ function m0(e, u) {
|
|
1511
1529
|
}
|
1512
1530
|
function x0(e) {
|
1513
1531
|
const u = bu(e), t = /\_([\w]{5,})$/, a = {};
|
1514
|
-
for (const
|
1515
|
-
t.test(
|
1532
|
+
for (const i of Object.keys(u))
|
1533
|
+
t.test(i) || (a[i] = u[i]);
|
1516
1534
|
return a;
|
1517
1535
|
}
|
1518
|
-
function
|
1536
|
+
function g0(e) {
|
1519
1537
|
if (!e) return {};
|
1520
1538
|
const u = {}, t = /\_([\w]{5,})$/;
|
1521
1539
|
for (const a of e.properties) {
|
1522
|
-
const
|
1523
|
-
if (t.test(
|
1540
|
+
const i = a.key.name;
|
1541
|
+
if (t.test(i))
|
1524
1542
|
try {
|
1525
1543
|
if (a.body.body[0]?.argument) {
|
1526
|
-
const
|
1544
|
+
const c = R(
|
1527
1545
|
a.body.body[0].argument.callee.object
|
1528
1546
|
);
|
1529
|
-
u[
|
1547
|
+
u[i] = C(c);
|
1530
1548
|
} else
|
1531
|
-
u[
|
1532
|
-
} catch (
|
1533
|
-
console.warn(
|
1549
|
+
u[i] = q(a)?.exp;
|
1550
|
+
} catch (c) {
|
1551
|
+
console.warn(c);
|
1534
1552
|
}
|
1535
1553
|
}
|
1536
1554
|
return u;
|
1537
1555
|
}
|
1538
|
-
function
|
1556
|
+
function y0(e) {
|
1539
1557
|
if (!e) return {};
|
1540
1558
|
const u = {};
|
1541
1559
|
for (const t of e.properties) {
|
@@ -1552,24 +1570,24 @@ function lu(e, u) {
|
|
1552
1570
|
(a) => a.key?.name === u
|
1553
1571
|
)?.value?.value;
|
1554
1572
|
}
|
1555
|
-
function
|
1573
|
+
function cu(e, u) {
|
1556
1574
|
const t = e.find(
|
1557
1575
|
(a) => a.key?.name === u
|
1558
1576
|
);
|
1559
1577
|
if (t)
|
1560
1578
|
return q(t)?.exp;
|
1561
1579
|
}
|
1562
|
-
function
|
1580
|
+
function S0(e, u = {}) {
|
1563
1581
|
const t = [];
|
1564
1582
|
for (const a of e.properties) {
|
1565
|
-
const { key:
|
1583
|
+
const { key: i, value: c } = a, s = i.value || i.name || "";
|
1566
1584
|
if (u[s]) {
|
1567
|
-
const n =
|
1585
|
+
const n = c.properties;
|
1568
1586
|
t.push({
|
1569
1587
|
source: u[s],
|
1570
1588
|
deep: B(n, "deep"),
|
1571
1589
|
immediate: B(n, "immediate"),
|
1572
|
-
handler:
|
1590
|
+
handler: cu(n, "handler")
|
1573
1591
|
});
|
1574
1592
|
} else if (a.type === "ObjectMethod" && t.push({
|
1575
1593
|
// todo: 处理上下文
|
@@ -1581,7 +1599,7 @@ function y0(e, u = {}) {
|
|
1581
1599
|
immediate: !1,
|
1582
1600
|
handler: q(a)?.exp
|
1583
1601
|
}), a.type === "ObjectProperty") {
|
1584
|
-
const n =
|
1602
|
+
const n = c.properties;
|
1585
1603
|
t.push({
|
1586
1604
|
// todo: 处理上下文
|
1587
1605
|
source: {
|
@@ -1590,24 +1608,24 @@ function y0(e, u = {}) {
|
|
1590
1608
|
},
|
1591
1609
|
deep: B(n, "deep"),
|
1592
1610
|
immediate: B(n, "immediate"),
|
1593
|
-
handler:
|
1611
|
+
handler: cu(n, "handler")
|
1594
1612
|
});
|
1595
1613
|
}
|
1596
1614
|
}
|
1597
1615
|
return t;
|
1598
1616
|
}
|
1599
|
-
function
|
1617
|
+
function E0(e) {
|
1600
1618
|
const u = {};
|
1601
1619
|
for (const t of e) {
|
1602
1620
|
const a = t.key.name;
|
1603
1621
|
if (Pu.includes(a)) {
|
1604
|
-
const
|
1605
|
-
|
1622
|
+
const i = q(t);
|
1623
|
+
i && (u[i.name] = i.exp);
|
1606
1624
|
}
|
1607
1625
|
}
|
1608
1626
|
return u;
|
1609
1627
|
}
|
1610
|
-
function
|
1628
|
+
function v0(e) {
|
1611
1629
|
const u = e.find(
|
1612
1630
|
(t) => t.key?.name === "type"
|
1613
1631
|
);
|
@@ -1619,38 +1637,38 @@ function hu(e) {
|
|
1619
1637
|
(t) => t.key?.name === "default"
|
1620
1638
|
);
|
1621
1639
|
if (u)
|
1622
|
-
return
|
1640
|
+
return v(R(u.value));
|
1623
1641
|
}
|
1624
|
-
function
|
1642
|
+
function w0(e) {
|
1625
1643
|
if (!e) return [];
|
1626
1644
|
let u = [];
|
1627
1645
|
return e.type === "ArrayExpression" ? u = e.elements.map((t) => t.value) : e.type === "ObjectExpression" && (u = e.properties.map((t) => {
|
1628
|
-
const { key: a, value:
|
1646
|
+
const { key: a, value: i } = t, c = i.properties || [];
|
1629
1647
|
return {
|
1630
1648
|
name: a.name,
|
1631
|
-
required: B(
|
1632
|
-
type:
|
1633
|
-
default: hu(
|
1649
|
+
required: B(c, "required"),
|
1650
|
+
type: v0(c),
|
1651
|
+
default: hu(c)
|
1634
1652
|
};
|
1635
1653
|
})), u;
|
1636
1654
|
}
|
1637
|
-
function
|
1655
|
+
function A0(e) {
|
1638
1656
|
const u = [];
|
1639
1657
|
if (e.callee.type === "MemberExpression" && e.callee.property?.name === "$emit") {
|
1640
|
-
const [a, ...
|
1641
|
-
(
|
1658
|
+
const [a, ...i] = (e.arguments || []).map(
|
1659
|
+
(c) => c.value || c.name
|
1642
1660
|
);
|
1643
1661
|
a && u.push({
|
1644
1662
|
name: a,
|
1645
|
-
params:
|
1663
|
+
params: i
|
1646
1664
|
});
|
1647
1665
|
}
|
1648
1666
|
return u;
|
1649
1667
|
}
|
1650
|
-
function
|
1668
|
+
function T0(e) {
|
1651
1669
|
let u = [];
|
1652
1670
|
return e.type === "ObjectExpression" && (u = e.properties.map((t) => {
|
1653
|
-
const { key: a, value:
|
1671
|
+
const { key: a, value: i } = t, c = i.properties, s = a.name, n = lu(c, "from"), d = hu(c);
|
1654
1672
|
return {
|
1655
1673
|
name: s,
|
1656
1674
|
from: n || s,
|
@@ -1658,22 +1676,22 @@ function A0(e) {
|
|
1658
1676
|
};
|
1659
1677
|
})), u;
|
1660
1678
|
}
|
1661
|
-
function
|
1679
|
+
function I0(e, u) {
|
1662
1680
|
return (e.apis || []).find((t) => t.id === u);
|
1663
1681
|
}
|
1664
|
-
function
|
1682
|
+
function N0(e) {
|
1665
1683
|
const u = [], t = {}, a = [];
|
1666
1684
|
try {
|
1667
|
-
const
|
1668
|
-
for (const s of
|
1685
|
+
const i = Ru.parse(e), c = /^.[\w]+_[\w]{5,}/;
|
1686
|
+
for (const s of i.nodes)
|
1669
1687
|
if (s.type === "rule") {
|
1670
1688
|
const n = {};
|
1671
|
-
|
1689
|
+
c.test(s.selector) ? (s.nodes.forEach((d) => {
|
1672
1690
|
d.type === "decl" && (n[d.prop] = d.value);
|
1673
1691
|
}), t[s.selector] = n) : a.push(s.toString());
|
1674
1692
|
}
|
1675
|
-
} catch (
|
1676
|
-
u.push(`css解析出错了,错误信息:[ ${
|
1693
|
+
} catch (i) {
|
1694
|
+
u.push(`css解析出错了,错误信息:[ ${i.message} ]
|
1677
1695
|
`);
|
1678
1696
|
}
|
1679
1697
|
return {
|
@@ -1683,46 +1701,46 @@ function I0(e) {
|
|
1683
1701
|
`)
|
1684
1702
|
};
|
1685
1703
|
}
|
1686
|
-
async function
|
1687
|
-
const u = [], { id: t, name: a, source:
|
1688
|
-
if (Fu(
|
1704
|
+
async function H0(e) {
|
1705
|
+
const u = [], { id: t, name: a, source: i, project: c } = e;
|
1706
|
+
if (Fu(i))
|
1689
1707
|
return u.push("style的lang不能是scss, 请改为css"), Promise.reject(u);
|
1690
|
-
const { dependencies: s = [] } =
|
1708
|
+
const { dependencies: s = [] } = c || {}, n = su(i), {
|
1691
1709
|
styles: d,
|
1692
1710
|
css: b,
|
1693
|
-
errors:
|
1694
|
-
} =
|
1711
|
+
errors: h
|
1712
|
+
} = N0(n.styles.join(`
|
1695
1713
|
`)), {
|
1696
1714
|
state: o,
|
1697
1715
|
watch: S,
|
1698
|
-
lifeCycles:
|
1699
|
-
computed:
|
1716
|
+
lifeCycles: p,
|
1717
|
+
computed: E,
|
1700
1718
|
methods: w,
|
1701
1719
|
props: mu,
|
1702
|
-
emits:
|
1703
|
-
inject:
|
1720
|
+
emits: pu,
|
1721
|
+
inject: xu,
|
1704
1722
|
handlers: gu,
|
1705
1723
|
imports: yu,
|
1706
1724
|
dataSources: Su
|
1707
|
-
} =
|
1725
|
+
} = b0(n.script, c), { nodes: Eu, slots: vu, context: wu } = i0(t, a, n.template, {
|
1708
1726
|
handlers: gu,
|
1709
1727
|
styles: d
|
1710
1728
|
}), J = {
|
1711
1729
|
id: t,
|
1712
1730
|
name: a,
|
1713
|
-
inject:
|
1731
|
+
inject: xu,
|
1714
1732
|
props: mu,
|
1715
1733
|
state: o,
|
1716
1734
|
watch: S,
|
1717
|
-
lifeCycles:
|
1718
|
-
computed:
|
1735
|
+
lifeCycles: p,
|
1736
|
+
computed: E,
|
1719
1737
|
methods: w,
|
1720
1738
|
dataSources: Su,
|
1721
1739
|
slots: vu,
|
1722
|
-
emits:
|
1740
|
+
emits: pu,
|
1723
1741
|
nodes: Eu,
|
1724
1742
|
css: b
|
1725
|
-
}, Au = Object.keys(
|
1743
|
+
}, Au = Object.keys(E || {}), Tu = [
|
1726
1744
|
"$el",
|
1727
1745
|
"$emit",
|
1728
1746
|
"$nextTick",
|
@@ -1739,92 +1757,92 @@ async function j0(e) {
|
|
1739
1757
|
"$props",
|
1740
1758
|
"props",
|
1741
1759
|
...Object.keys(w || {})
|
1742
|
-
], { libs: Iu } =
|
1760
|
+
], { libs: Iu } = _0(yu, s), X = {
|
1743
1761
|
context: wu,
|
1744
1762
|
computed: Au,
|
1745
1763
|
libs: Iu,
|
1746
1764
|
members: Tu
|
1747
1765
|
};
|
1748
|
-
return await
|
1766
|
+
return await q0(
|
1749
1767
|
J,
|
1750
1768
|
async (_) => {
|
1751
|
-
await
|
1769
|
+
await k0(_, async (L) => {
|
1752
1770
|
if (G(L)) {
|
1753
1771
|
const Nu = await Q(L.value);
|
1754
|
-
L.value = Z(Nu, _.id,
|
1772
|
+
L.value = Z(Nu, _.id, X);
|
1755
1773
|
}
|
1756
1774
|
});
|
1757
1775
|
},
|
1758
1776
|
async (_) => {
|
1759
1777
|
const L = await Q(_.value);
|
1760
|
-
_.value = Z(L, "",
|
1778
|
+
_.value = Z(L, "", X);
|
1761
1779
|
}
|
1762
|
-
), u.push(...
|
1763
|
-
}
|
1764
|
-
async function
|
1765
|
-
const a = async (
|
1766
|
-
if (await u(
|
1767
|
-
for (const w of
|
1768
|
-
await a(w,
|
1769
|
-
},
|
1770
|
-
if (!
|
1771
|
-
if (Array.isArray(
|
1772
|
-
for (let w of
|
1773
|
-
await
|
1780
|
+
), u.push(...h), u.length ? Promise.reject(u) : new Lu(J).toDsl();
|
1781
|
+
}
|
1782
|
+
async function q0(e, u, t) {
|
1783
|
+
const a = async (p, E) => {
|
1784
|
+
if (await u(p, E), Array.isArray(p.children))
|
1785
|
+
for (const w of p.children)
|
1786
|
+
await a(w, p);
|
1787
|
+
}, i = async (p) => {
|
1788
|
+
if (!p || typeof p != "object") return;
|
1789
|
+
if (Array.isArray(p)) {
|
1790
|
+
for (let w of p)
|
1791
|
+
await i(w);
|
1774
1792
|
return;
|
1775
1793
|
}
|
1776
|
-
const
|
1777
|
-
for (const w of
|
1778
|
-
G(w) ? await t(w) : await
|
1794
|
+
const E = Object.values(p);
|
1795
|
+
for (const w of E)
|
1796
|
+
G(w) ? await t(w) : await i(w);
|
1779
1797
|
}, {
|
1780
|
-
state:
|
1798
|
+
state: c,
|
1781
1799
|
watch: s,
|
1782
1800
|
computed: n,
|
1783
1801
|
props: d,
|
1784
1802
|
dataSources: b,
|
1785
|
-
methods:
|
1803
|
+
methods: h,
|
1786
1804
|
lifeCycles: o,
|
1787
1805
|
inject: S
|
1788
1806
|
} = e;
|
1789
|
-
if (await
|
1790
|
-
state:
|
1807
|
+
if (await i({
|
1808
|
+
state: c,
|
1791
1809
|
watch: s,
|
1792
1810
|
computed: n,
|
1793
1811
|
props: d,
|
1794
1812
|
dataSources: b,
|
1795
|
-
methods:
|
1813
|
+
methods: h,
|
1796
1814
|
lifeCycles: o,
|
1797
1815
|
inject: S
|
1798
1816
|
}), Array.isArray(e.nodes))
|
1799
|
-
for (const
|
1800
|
-
await a(
|
1817
|
+
for (const p of e.nodes)
|
1818
|
+
await a(p);
|
1801
1819
|
}
|
1802
|
-
async function
|
1820
|
+
async function k0(e, u) {
|
1803
1821
|
const t = async (a) => {
|
1804
1822
|
if (!a || typeof a != "object") return;
|
1805
1823
|
if (Array.isArray(a)) {
|
1806
|
-
for (let
|
1807
|
-
await u(
|
1824
|
+
for (let c of a)
|
1825
|
+
await u(c), await t(c);
|
1808
1826
|
return;
|
1809
1827
|
}
|
1810
1828
|
if (G(a)) {
|
1811
1829
|
await u(a);
|
1812
1830
|
return;
|
1813
1831
|
}
|
1814
|
-
const
|
1815
|
-
for (const
|
1816
|
-
await u(
|
1832
|
+
const i = Object.values(a);
|
1833
|
+
for (const c of i)
|
1834
|
+
await u(c), await t(c);
|
1817
1835
|
};
|
1818
1836
|
await t(e);
|
1819
1837
|
}
|
1820
|
-
function
|
1838
|
+
function _0(e = [], u = []) {
|
1821
1839
|
const t = {}, a = u.reduce(
|
1822
|
-
(
|
1840
|
+
(i, c) => (i[c.package] = c.library, i),
|
1823
1841
|
{}
|
1824
1842
|
);
|
1825
|
-
for (const { from:
|
1826
|
-
|
1827
|
-
const n = a[
|
1843
|
+
for (const { from: i, imports: c } of e)
|
1844
|
+
c.forEach((s) => {
|
1845
|
+
const n = a[i];
|
1828
1846
|
n && (t[s] = n);
|
1829
1847
|
});
|
1830
1848
|
return {
|
@@ -1832,10 +1850,10 @@ function k0(e = [], u = []) {
|
|
1832
1850
|
};
|
1833
1851
|
}
|
1834
1852
|
export {
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1853
|
+
F0 as VTJ_PARSER_VERSION,
|
1854
|
+
iu as htmlToNodes,
|
1855
|
+
j0 as parseUniApp,
|
1856
|
+
H0 as parseVue,
|
1839
1857
|
Z as patchCode,
|
1840
1858
|
O as replacer
|
1841
1859
|
};
|