@vue/compiler-sfc 3.6.0-beta.10 → 3.6.0-beta.12
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-sfc.cjs.js +143 -45
- package/dist/compiler-sfc.d.ts +3 -3
- package/dist/compiler-sfc.esm-browser.js +982 -451
- package/package.json +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-beta.12
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -11,7 +11,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
13
|
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
14
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
14
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
15
15
|
var __exportAll = (all, no_symbols) => {
|
|
16
16
|
let target = {};
|
|
17
17
|
for (var name in all) __defProp(target, name, {
|
|
@@ -41,7 +41,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
41
41
|
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
42
42
|
});
|
|
43
43
|
//#endregion
|
|
44
|
-
//#region \0@oxc-project+runtime@0.
|
|
44
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
45
45
|
function _typeof(o) {
|
|
46
46
|
"@babel/helpers - typeof";
|
|
47
47
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -52,7 +52,7 @@ function _typeof(o) {
|
|
|
52
52
|
}
|
|
53
53
|
var init_typeof = __esmMin((() => {}));
|
|
54
54
|
//#endregion
|
|
55
|
-
//#region \0@oxc-project+runtime@0.
|
|
55
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
56
56
|
function toPrimitive(t, r) {
|
|
57
57
|
if ("object" != _typeof(t) || !t) return t;
|
|
58
58
|
var e = t[Symbol.toPrimitive];
|
|
@@ -67,7 +67,7 @@ var init_toPrimitive = __esmMin((() => {
|
|
|
67
67
|
init_typeof();
|
|
68
68
|
}));
|
|
69
69
|
//#endregion
|
|
70
|
-
//#region \0@oxc-project+runtime@0.
|
|
70
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
71
71
|
function toPropertyKey(t) {
|
|
72
72
|
var i = toPrimitive(t, "string");
|
|
73
73
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
@@ -77,7 +77,7 @@ var init_toPropertyKey = __esmMin((() => {
|
|
|
77
77
|
init_toPrimitive();
|
|
78
78
|
}));
|
|
79
79
|
//#endregion
|
|
80
|
-
//#region \0@oxc-project+runtime@0.
|
|
80
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
81
81
|
function _defineProperty(e, r, t) {
|
|
82
82
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
83
83
|
value: t,
|
|
@@ -90,7 +90,7 @@ var init_defineProperty = __esmMin((() => {
|
|
|
90
90
|
init_toPropertyKey();
|
|
91
91
|
}));
|
|
92
92
|
//#endregion
|
|
93
|
-
//#region \0@oxc-project+runtime@0.
|
|
93
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/objectSpread2.js
|
|
94
94
|
function ownKeys(e, r) {
|
|
95
95
|
var t = Object.keys(e);
|
|
96
96
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1069,6 +1069,12 @@ function write(buffer, value, offset, isLE, mLen, nBytes) {
|
|
|
1069
1069
|
for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8);
|
|
1070
1070
|
buffer[offset + i - d] |= s * 128;
|
|
1071
1071
|
}
|
|
1072
|
+
/*!
|
|
1073
|
+
* The buffer module from node.js, for the browser.
|
|
1074
|
+
*
|
|
1075
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
1076
|
+
* @license MIT
|
|
1077
|
+
*/
|
|
1072
1078
|
function kMaxLength() {
|
|
1073
1079
|
return Buffer$1.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
|
|
1074
1080
|
}
|
|
@@ -3594,7 +3600,7 @@ const errorMessages$1 = {
|
|
|
3594
3600
|
[54]: ``
|
|
3595
3601
|
};
|
|
3596
3602
|
//#endregion
|
|
3597
|
-
//#region node_modules/.pnpm/@babel+parser@7.29.
|
|
3603
|
+
//#region node_modules/.pnpm/@babel+parser@7.29.3/node_modules/@babel/parser/lib/index.js
|
|
3598
3604
|
var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3599
3605
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3600
3606
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
@@ -6138,7 +6144,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6138
6144
|
}
|
|
6139
6145
|
flowParseDeclareVariable(node) {
|
|
6140
6146
|
this.next();
|
|
6141
|
-
node.id = this.flowParseTypeAnnotatableIdentifier(
|
|
6147
|
+
node.id = this.flowParseTypeAnnotatableIdentifier();
|
|
6142
6148
|
this.scope.declareName(node.id.name, 5, node.id.loc.start);
|
|
6143
6149
|
this.semicolon();
|
|
6144
6150
|
return this.finishNode(node, "DeclareVariable");
|
|
@@ -6282,9 +6288,14 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6282
6288
|
if (!reservedTypes.has(word)) return;
|
|
6283
6289
|
this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, startLoc, { reservedType: word });
|
|
6284
6290
|
}
|
|
6285
|
-
|
|
6291
|
+
flowParseRestrictedIdentifierName(liberal, declaration) {
|
|
6286
6292
|
this.checkReservedType(this.state.value, this.state.startLoc, declaration);
|
|
6287
|
-
return this.
|
|
6293
|
+
return this.parseIdentifierName(liberal);
|
|
6294
|
+
}
|
|
6295
|
+
flowParseRestrictedIdentifier(liberal, declaration) {
|
|
6296
|
+
const node = this.startNode();
|
|
6297
|
+
const name = this.flowParseRestrictedIdentifierName(liberal, declaration);
|
|
6298
|
+
return this.createIdentifier(node, name);
|
|
6288
6299
|
}
|
|
6289
6300
|
flowParseTypeAlias(node) {
|
|
6290
6301
|
node.id = this.flowParseRestrictedIdentifier(false, true);
|
|
@@ -6308,14 +6319,21 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6308
6319
|
this.semicolon();
|
|
6309
6320
|
return this.finishNode(node, "OpaqueType");
|
|
6310
6321
|
}
|
|
6322
|
+
flowParseTypeParameterBound() {
|
|
6323
|
+
if (this.match(14) || this.isContextual(81)) {
|
|
6324
|
+
const node = this.startNode();
|
|
6325
|
+
this.next();
|
|
6326
|
+
node.typeAnnotation = this.flowParseType();
|
|
6327
|
+
return this.finishNode(node, "TypeAnnotation");
|
|
6328
|
+
}
|
|
6329
|
+
}
|
|
6311
6330
|
flowParseTypeParameter(requireDefault = false) {
|
|
6312
6331
|
const nodeStartLoc = this.state.startLoc;
|
|
6313
6332
|
const node = this.startNode();
|
|
6314
6333
|
const variance = this.flowParseVariance();
|
|
6315
|
-
|
|
6316
|
-
node.name = ident.name;
|
|
6334
|
+
node.name = this.flowParseRestrictedIdentifierName();
|
|
6317
6335
|
node.variance = variance;
|
|
6318
|
-
node.bound =
|
|
6336
|
+
node.bound = this.flowParseTypeParameterBound();
|
|
6319
6337
|
if (this.match(29)) {
|
|
6320
6338
|
this.eat(29);
|
|
6321
6339
|
node.default = this.flowParseType();
|
|
@@ -6873,13 +6891,11 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6873
6891
|
node.typeAnnotation = this.flowParseTypeInitialiser();
|
|
6874
6892
|
return this.finishNode(node, "TypeAnnotation");
|
|
6875
6893
|
}
|
|
6876
|
-
flowParseTypeAnnotatableIdentifier(
|
|
6877
|
-
const
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
}
|
|
6882
|
-
return ident;
|
|
6894
|
+
flowParseTypeAnnotatableIdentifier() {
|
|
6895
|
+
const node = this.startNode();
|
|
6896
|
+
const name = this.parseIdentifierName();
|
|
6897
|
+
if (this.match(14)) node.typeAnnotation = this.flowParseTypeAnnotation();
|
|
6898
|
+
return this.createIdentifier(node, name);
|
|
6883
6899
|
}
|
|
6884
6900
|
typeCastToParameter(node) {
|
|
6885
6901
|
node.expression.typeAnnotation = node.typeAnnotation;
|
|
@@ -8675,6 +8691,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8675
8691
|
adjustInnerComments(node, node.properties, commentWS);
|
|
8676
8692
|
break;
|
|
8677
8693
|
case "CallExpression":
|
|
8694
|
+
case "NewExpression":
|
|
8678
8695
|
case "OptionalCallExpression":
|
|
8679
8696
|
adjustInnerComments(node, node.arguments, commentWS);
|
|
8680
8697
|
break;
|
|
@@ -8687,6 +8704,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8687
8704
|
case "ObjectMethod":
|
|
8688
8705
|
case "ClassMethod":
|
|
8689
8706
|
case "ClassPrivateMethod":
|
|
8707
|
+
case "TSTypeParameterDeclaration":
|
|
8690
8708
|
adjustInnerComments(node, node.params, commentWS);
|
|
8691
8709
|
break;
|
|
8692
8710
|
case "ArrayExpression":
|
|
@@ -8703,6 +8721,9 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8703
8721
|
case "TSEnumBody":
|
|
8704
8722
|
adjustInnerComments(node, node.members, commentWS);
|
|
8705
8723
|
break;
|
|
8724
|
+
case "TSInterfaceBody":
|
|
8725
|
+
adjustInnerComments(node, node.body, commentWS);
|
|
8726
|
+
break;
|
|
8706
8727
|
default:
|
|
8707
8728
|
if (node.type === "RecordExpression") {
|
|
8708
8729
|
adjustInnerComments(node, node.properties, commentWS);
|
|
@@ -10259,7 +10280,8 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10259
10280
|
const oldInModule = this.inModule;
|
|
10260
10281
|
this.inModule = inModule;
|
|
10261
10282
|
const oldScope = this.scope;
|
|
10262
|
-
|
|
10283
|
+
const ScopeHandler = this.getScopeHandler();
|
|
10284
|
+
this.scope = new ScopeHandler(this, inModule);
|
|
10263
10285
|
const oldProdParam = this.prodParam;
|
|
10264
10286
|
this.prodParam = new ProductionParameterHandler();
|
|
10265
10287
|
const oldClassScope = this.classScope;
|
|
@@ -16166,7 +16188,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
16166
16188
|
exports.parseExpression = parseExpression;
|
|
16167
16189
|
}));
|
|
16168
16190
|
//#endregion
|
|
16169
|
-
//#region \0@oxc-project+runtime@0.
|
|
16191
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/asyncToGenerator.js
|
|
16170
16192
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
16171
16193
|
try {
|
|
16172
16194
|
var i = n[a](c), u = i.value;
|
|
@@ -17621,6 +17643,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
17621
17643
|
constantCache: /* @__PURE__ */ new WeakMap(),
|
|
17622
17644
|
temps: 0,
|
|
17623
17645
|
identifiers: Object.create(null),
|
|
17646
|
+
identifierScopes: Object.create(null),
|
|
17624
17647
|
scopes: {
|
|
17625
17648
|
vFor: 0,
|
|
17626
17649
|
vSlot: 0,
|
|
@@ -17671,16 +17694,20 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
17671
17694
|
context.parent.children.splice(removalIndex, 1);
|
|
17672
17695
|
},
|
|
17673
17696
|
onNodeRemoved: NOOP,
|
|
17674
|
-
addIdentifiers(exp) {
|
|
17675
|
-
if (isString$1(exp)) addId(exp);
|
|
17676
|
-
else if (exp.identifiers) exp.identifiers.forEach(addId);
|
|
17677
|
-
else if (exp.type === 4) addId(exp.content);
|
|
17697
|
+
addIdentifiers(exp, type = "local") {
|
|
17698
|
+
if (isString$1(exp)) addId(exp, type);
|
|
17699
|
+
else if (exp.identifiers) exp.identifiers.forEach((id) => addId(id, type));
|
|
17700
|
+
else if (exp.type === 4) addId(exp.content, type);
|
|
17678
17701
|
},
|
|
17679
17702
|
removeIdentifiers(exp) {
|
|
17680
17703
|
if (isString$1(exp)) removeId(exp);
|
|
17681
17704
|
else if (exp.identifiers) exp.identifiers.forEach(removeId);
|
|
17682
17705
|
else if (exp.type === 4) removeId(exp.content);
|
|
17683
17706
|
},
|
|
17707
|
+
isSlotScopeIdentifier(name) {
|
|
17708
|
+
const scopes = context.identifierScopes[name];
|
|
17709
|
+
return scopes ? scopes[scopes.length - 1] === "slot" : false;
|
|
17710
|
+
},
|
|
17684
17711
|
hoist(exp) {
|
|
17685
17712
|
if (isString$1(exp)) exp = createSimpleExpression(exp);
|
|
17686
17713
|
context.hoists.push(exp);
|
|
@@ -17694,13 +17721,16 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
17694
17721
|
return cacheExp;
|
|
17695
17722
|
}
|
|
17696
17723
|
};
|
|
17697
|
-
function addId(id) {
|
|
17698
|
-
const { identifiers } = context;
|
|
17724
|
+
function addId(id, type) {
|
|
17725
|
+
const { identifiers, identifierScopes } = context;
|
|
17699
17726
|
if (identifiers[id] === void 0) identifiers[id] = 0;
|
|
17700
17727
|
identifiers[id]++;
|
|
17728
|
+
(identifierScopes[id] || (identifierScopes[id] = [])).push(type);
|
|
17701
17729
|
}
|
|
17702
17730
|
function removeId(id) {
|
|
17703
17731
|
context.identifiers[id]--;
|
|
17732
|
+
const scopes = context.identifierScopes[id];
|
|
17733
|
+
if (scopes) scopes.pop();
|
|
17704
17734
|
}
|
|
17705
17735
|
return context;
|
|
17706
17736
|
}
|
|
@@ -20870,7 +20900,7 @@ const trackSlotScopes = (node, context) => {
|
|
|
20870
20900
|
const vSlot = findDir$1(node, "slot");
|
|
20871
20901
|
if (vSlot) {
|
|
20872
20902
|
const slotProps = vSlot.exp;
|
|
20873
|
-
if (context.prefixIdentifiers) slotProps && context.addIdentifiers(slotProps);
|
|
20903
|
+
if (context.prefixIdentifiers) slotProps && context.addIdentifiers(slotProps, "slot");
|
|
20874
20904
|
context.scopes.vSlot++;
|
|
20875
20905
|
return () => {
|
|
20876
20906
|
if (context.prefixIdentifiers) slotProps && context.removeIdentifiers(slotProps);
|
|
@@ -21089,6 +21119,15 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
21089
21119
|
if (!ssr) context.helper(builtIn);
|
|
21090
21120
|
return builtIn;
|
|
21091
21121
|
}
|
|
21122
|
+
{
|
|
21123
|
+
const fromScope = resolveSlotScopeReference(tag, context);
|
|
21124
|
+
if (fromScope) return fromScope;
|
|
21125
|
+
const dotIndex = tag.indexOf(".");
|
|
21126
|
+
if (dotIndex > 0) {
|
|
21127
|
+
const ns = resolveSlotScopeReference(tag.slice(0, dotIndex), context);
|
|
21128
|
+
if (ns) return ns + tag.slice(dotIndex);
|
|
21129
|
+
}
|
|
21130
|
+
}
|
|
21092
21131
|
{
|
|
21093
21132
|
const fromSetup = resolveSetupReference$1(tag, context);
|
|
21094
21133
|
if (fromSetup) return fromSetup;
|
|
@@ -21107,6 +21146,14 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
21107
21146
|
context.components.add(tag);
|
|
21108
21147
|
return toValidAssetId(tag, `component`);
|
|
21109
21148
|
}
|
|
21149
|
+
function resolveSlotScopeReference(name, context) {
|
|
21150
|
+
const camelName = camelize(name);
|
|
21151
|
+
const PascalName = capitalize(camelName);
|
|
21152
|
+
const isInSlotScope = (reference) => context.isSlotScopeIdentifier(reference);
|
|
21153
|
+
if (isInSlotScope(name)) return name;
|
|
21154
|
+
if (isInSlotScope(camelName)) return camelName;
|
|
21155
|
+
if (isInSlotScope(PascalName)) return PascalName;
|
|
21156
|
+
}
|
|
21110
21157
|
function resolveSetupReference$1(name, context) {
|
|
21111
21158
|
const bindings = context.bindingMetadata;
|
|
21112
21159
|
if (!bindings || bindings.__isScriptSetup === false) return;
|
|
@@ -23324,6 +23371,7 @@ var init__polyfill_node_path = __esmMin((() => {
|
|
|
23324
23371
|
}));
|
|
23325
23372
|
//#endregion
|
|
23326
23373
|
//#region \0polyfill-node.punycode.js
|
|
23374
|
+
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
23327
23375
|
/**
|
|
23328
23376
|
* A generic error utility function.
|
|
23329
23377
|
* @private
|
|
@@ -24423,13 +24471,15 @@ init_objectSpread2();
|
|
|
24423
24471
|
const resourceUrlTagConfig = {
|
|
24424
24472
|
video: ["src", "poster"],
|
|
24425
24473
|
source: ["src"],
|
|
24426
|
-
img: ["src"]
|
|
24427
|
-
image: ["xlink:href", "href"]
|
|
24474
|
+
img: ["src"]
|
|
24428
24475
|
};
|
|
24429
24476
|
const defaultAssetUrlOptions = {
|
|
24430
24477
|
base: null,
|
|
24431
24478
|
includeAbsolute: false,
|
|
24432
|
-
tags: _objectSpread2(_objectSpread2({}, resourceUrlTagConfig), {}, {
|
|
24479
|
+
tags: _objectSpread2(_objectSpread2({}, resourceUrlTagConfig), {}, {
|
|
24480
|
+
image: ["xlink:href", "href"],
|
|
24481
|
+
use: ["xlink:href", "href"]
|
|
24482
|
+
})
|
|
24433
24483
|
};
|
|
24434
24484
|
const normalizeOptions = (options) => {
|
|
24435
24485
|
if (Object.keys(options).some((key) => isArray$3(options[key]))) return _objectSpread2(_objectSpread2({}, defaultAssetUrlOptions), {}, { tags: options });
|
|
@@ -24467,7 +24517,7 @@ const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
|
|
|
24467
24517
|
if (attr.type !== 6 || !assetAttrs.includes(attr.name) || !attr.value) return;
|
|
24468
24518
|
const urlValue = attr.value.content;
|
|
24469
24519
|
const isHashOnlyValue = urlValue[0] === "#";
|
|
24470
|
-
if (isExternalUrl(urlValue) || isDataUrl(urlValue) || isHashOnlyValue && !canTransformHashImport(node.tag, attr.name) || !options.includeAbsolute && !isRelativeUrl(urlValue)) return;
|
|
24520
|
+
if (isExternalUrl(urlValue) || isDataUrl(urlValue) || urlValue === "#" || isHashOnlyValue && !canTransformHashImport(node.tag, attr.name) || !options.includeAbsolute && !isRelativeUrl(urlValue)) return;
|
|
24471
24521
|
const url = parseUrl(urlValue);
|
|
24472
24522
|
if (options.base && urlValue[0] === ".") {
|
|
24473
24523
|
const base = parseUrl(options.base);
|
|
@@ -24631,6 +24681,90 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
|
|
|
24631
24681
|
}
|
|
24632
24682
|
};
|
|
24633
24683
|
//#endregion
|
|
24684
|
+
//#region packages/compiler-vapor/src/ir/component.ts
|
|
24685
|
+
const IRDynamicPropsKind = {
|
|
24686
|
+
"EXPRESSION": 0,
|
|
24687
|
+
"0": "EXPRESSION",
|
|
24688
|
+
"ATTRIBUTE": 1,
|
|
24689
|
+
"1": "ATTRIBUTE"
|
|
24690
|
+
};
|
|
24691
|
+
const IRSlotType = {
|
|
24692
|
+
"STATIC": 0,
|
|
24693
|
+
"0": "STATIC",
|
|
24694
|
+
"DYNAMIC": 1,
|
|
24695
|
+
"1": "DYNAMIC",
|
|
24696
|
+
"LOOP": 2,
|
|
24697
|
+
"2": "LOOP",
|
|
24698
|
+
"CONDITIONAL": 3,
|
|
24699
|
+
"3": "CONDITIONAL",
|
|
24700
|
+
"EXPRESSION": 4,
|
|
24701
|
+
"4": "EXPRESSION"
|
|
24702
|
+
};
|
|
24703
|
+
//#endregion
|
|
24704
|
+
//#region packages/compiler-vapor/src/ir/index.ts
|
|
24705
|
+
const IRNodeTypes = {
|
|
24706
|
+
"ROOT": 0,
|
|
24707
|
+
"0": "ROOT",
|
|
24708
|
+
"BLOCK": 1,
|
|
24709
|
+
"1": "BLOCK",
|
|
24710
|
+
"SET_BLOCK_KEY": 2,
|
|
24711
|
+
"2": "SET_BLOCK_KEY",
|
|
24712
|
+
"SET_PROP": 3,
|
|
24713
|
+
"3": "SET_PROP",
|
|
24714
|
+
"SET_DYNAMIC_PROPS": 4,
|
|
24715
|
+
"4": "SET_DYNAMIC_PROPS",
|
|
24716
|
+
"SET_TEXT": 5,
|
|
24717
|
+
"5": "SET_TEXT",
|
|
24718
|
+
"SET_EVENT": 6,
|
|
24719
|
+
"6": "SET_EVENT",
|
|
24720
|
+
"SET_DYNAMIC_EVENTS": 7,
|
|
24721
|
+
"7": "SET_DYNAMIC_EVENTS",
|
|
24722
|
+
"SET_HTML": 8,
|
|
24723
|
+
"8": "SET_HTML",
|
|
24724
|
+
"SET_TEMPLATE_REF": 9,
|
|
24725
|
+
"9": "SET_TEMPLATE_REF",
|
|
24726
|
+
"INSERT_NODE": 10,
|
|
24727
|
+
"10": "INSERT_NODE",
|
|
24728
|
+
"PREPEND_NODE": 11,
|
|
24729
|
+
"11": "PREPEND_NODE",
|
|
24730
|
+
"CREATE_COMPONENT_NODE": 12,
|
|
24731
|
+
"12": "CREATE_COMPONENT_NODE",
|
|
24732
|
+
"SLOT_OUTLET_NODE": 13,
|
|
24733
|
+
"13": "SLOT_OUTLET_NODE",
|
|
24734
|
+
"DIRECTIVE": 14,
|
|
24735
|
+
"14": "DIRECTIVE",
|
|
24736
|
+
"IF": 15,
|
|
24737
|
+
"15": "IF",
|
|
24738
|
+
"FOR": 16,
|
|
24739
|
+
"16": "FOR",
|
|
24740
|
+
"KEY": 17,
|
|
24741
|
+
"17": "KEY",
|
|
24742
|
+
"GET_TEXT_CHILD": 18,
|
|
24743
|
+
"18": "GET_TEXT_CHILD"
|
|
24744
|
+
};
|
|
24745
|
+
var TemplateRegistry = class {
|
|
24746
|
+
constructor() {
|
|
24747
|
+
this.entries = [];
|
|
24748
|
+
}
|
|
24749
|
+
keys() {
|
|
24750
|
+
return this.entries.map(({ content }) => content);
|
|
24751
|
+
}
|
|
24752
|
+
};
|
|
24753
|
+
const DynamicFlag = {
|
|
24754
|
+
"NONE": 0,
|
|
24755
|
+
"0": "NONE",
|
|
24756
|
+
"REFERENCED": 1,
|
|
24757
|
+
"1": "REFERENCED",
|
|
24758
|
+
"NON_TEMPLATE": 2,
|
|
24759
|
+
"2": "NON_TEMPLATE",
|
|
24760
|
+
"INSERT": 4,
|
|
24761
|
+
"4": "INSERT"
|
|
24762
|
+
};
|
|
24763
|
+
function isBlockOperation(op) {
|
|
24764
|
+
const type = op.type;
|
|
24765
|
+
return type === 12 || type === 13 || type === 15 || type === 17 || type === 16;
|
|
24766
|
+
}
|
|
24767
|
+
//#endregion
|
|
24634
24768
|
//#region packages/compiler-vapor/src/transforms/utils.ts
|
|
24635
24769
|
const newDynamic = () => ({
|
|
24636
24770
|
flags: 1,
|
|
@@ -24746,6 +24880,7 @@ function isTeleportTag(tag) {
|
|
|
24746
24880
|
}
|
|
24747
24881
|
function isBuiltInComponent(tag) {
|
|
24748
24882
|
if (isTeleportTag(tag)) return "VaporTeleport";
|
|
24883
|
+
else if (tag === "Suspense" || tag === "suspense") return "Suspense";
|
|
24749
24884
|
else if (isKeepAliveTag(tag)) return "VaporKeepAlive";
|
|
24750
24885
|
else if (isTransitionTag(tag)) return "VaporTransition";
|
|
24751
24886
|
else if (isTransitionGroupTag(tag)) return "VaporTransitionGroup";
|
|
@@ -24767,6 +24902,8 @@ var TransformContext = class TransformContext {
|
|
|
24767
24902
|
this.index = 0;
|
|
24768
24903
|
this.block = this.ir.block;
|
|
24769
24904
|
this.template = "";
|
|
24905
|
+
this.templateRoot = false;
|
|
24906
|
+
this.templateIndexMap = /* @__PURE__ */ new Map();
|
|
24770
24907
|
this.childrenTemplate = [];
|
|
24771
24908
|
this.dynamic = this.ir.block.dynamic;
|
|
24772
24909
|
this.imports = [];
|
|
@@ -24776,9 +24913,12 @@ var TransformContext = class TransformContext {
|
|
|
24776
24913
|
this.component = this.ir.component;
|
|
24777
24914
|
this.directive = this.ir.directive;
|
|
24778
24915
|
this.slots = [];
|
|
24916
|
+
this.effectIndex = this.block.effect.length;
|
|
24917
|
+
this.operationIndex = this.block.operation.length;
|
|
24779
24918
|
this.isLastEffectiveChild = true;
|
|
24780
24919
|
this.isOnRightmostPath = true;
|
|
24781
|
-
this.
|
|
24920
|
+
this.templateCloseTags = void 0;
|
|
24921
|
+
this.templateCloseBlocks = false;
|
|
24782
24922
|
this.globalId = 0;
|
|
24783
24923
|
this.nextIdMap = null;
|
|
24784
24924
|
this.ifIndex = 0;
|
|
@@ -24793,20 +24933,28 @@ var TransformContext = class TransformContext {
|
|
|
24793
24933
|
this.initNextIdMap();
|
|
24794
24934
|
}
|
|
24795
24935
|
enterBlock(ir, isVFor = false) {
|
|
24796
|
-
const { block, template, dynamic, childrenTemplate, slots } = this;
|
|
24936
|
+
const { block, template, templateRoot, templateIndexMap, dynamic, childrenTemplate, slots, effectIndex, operationIndex } = this;
|
|
24797
24937
|
this.block = ir;
|
|
24798
24938
|
this.dynamic = ir.dynamic;
|
|
24799
24939
|
this.template = "";
|
|
24940
|
+
this.templateRoot = false;
|
|
24941
|
+
this.templateIndexMap = templateIndexMap;
|
|
24800
24942
|
this.childrenTemplate = [];
|
|
24801
24943
|
this.slots = [];
|
|
24944
|
+
this.effectIndex = ir.effect.length;
|
|
24945
|
+
this.operationIndex = ir.operation.length;
|
|
24802
24946
|
isVFor && this.inVFor++;
|
|
24803
24947
|
return () => {
|
|
24804
24948
|
this.registerTemplate();
|
|
24805
24949
|
this.block = block;
|
|
24806
24950
|
this.template = template;
|
|
24951
|
+
this.templateRoot = templateRoot;
|
|
24952
|
+
this.templateIndexMap = templateIndexMap;
|
|
24807
24953
|
this.dynamic = dynamic;
|
|
24808
24954
|
this.childrenTemplate = childrenTemplate;
|
|
24809
24955
|
this.slots = slots;
|
|
24956
|
+
this.effectIndex = effectIndex;
|
|
24957
|
+
this.operationIndex = operationIndex;
|
|
24810
24958
|
isVFor && this.inVFor--;
|
|
24811
24959
|
};
|
|
24812
24960
|
}
|
|
@@ -24831,54 +24979,94 @@ var TransformContext = class TransformContext {
|
|
|
24831
24979
|
nextIfIndex() {
|
|
24832
24980
|
return this.ifIndex++;
|
|
24833
24981
|
}
|
|
24834
|
-
|
|
24835
|
-
|
|
24982
|
+
getTemplateNamespace() {
|
|
24983
|
+
return this.node.type === 1 ? this.node.ns : 0;
|
|
24984
|
+
}
|
|
24985
|
+
canUseStaticTemplate() {
|
|
24986
|
+
if (!this.template) return false;
|
|
24987
|
+
if (this.inVFor) return false;
|
|
24988
|
+
if (this.dynamic.hasDynamicChild) return false;
|
|
24989
|
+
if (this.block.effect.length !== this.effectIndex) return false;
|
|
24990
|
+
if (this.block.operation.length !== this.operationIndex) return false;
|
|
24991
|
+
if (this.node.type === 2 || this.node.type === 3) return true;
|
|
24992
|
+
return this.node.type === 1 && this.node.tagType === 0 && !(this.options.isCustomElement(this.node.tag) || this.node.tag === "template");
|
|
24993
|
+
}
|
|
24994
|
+
pushTemplate(content, { root = false, static: isStatic = false } = {}) {
|
|
24995
|
+
const templateKey = JSON.stringify([
|
|
24996
|
+
this.getTemplateNamespace(),
|
|
24997
|
+
root,
|
|
24998
|
+
isStatic,
|
|
24999
|
+
content
|
|
25000
|
+
]);
|
|
25001
|
+
const existingIndex = this.templateIndexMap.get(templateKey);
|
|
24836
25002
|
if (existingIndex !== void 0) return existingIndex;
|
|
24837
|
-
const
|
|
24838
|
-
this.ir.template.
|
|
24839
|
-
this.ir.
|
|
25003
|
+
const ns = this.getTemplateNamespace();
|
|
25004
|
+
const newIndex = this.ir.template.entries.length;
|
|
25005
|
+
this.ir.template.entries.push({
|
|
25006
|
+
content,
|
|
25007
|
+
ns,
|
|
25008
|
+
root,
|
|
25009
|
+
static: isStatic
|
|
25010
|
+
});
|
|
25011
|
+
this.templateIndexMap.set(templateKey, newIndex);
|
|
24840
25012
|
return newIndex;
|
|
24841
25013
|
}
|
|
24842
25014
|
registerTemplate() {
|
|
24843
25015
|
if (!this.template) return -1;
|
|
24844
|
-
const id = this.pushTemplate(this.template
|
|
25016
|
+
const id = this.pushTemplate(this.template, {
|
|
25017
|
+
root: this.templateRoot,
|
|
25018
|
+
static: this.canUseStaticTemplate()
|
|
25019
|
+
});
|
|
24845
25020
|
return this.dynamic.template = id;
|
|
24846
25021
|
}
|
|
24847
|
-
registerEffect(expressions, operation, getIndex
|
|
25022
|
+
registerEffect(expressions, operation, getIndex) {
|
|
24848
25023
|
const operations = [operation].flat();
|
|
24849
25024
|
expressions = expressions.filter((exp) => !isConstantExpression(exp));
|
|
24850
25025
|
if (this.inVOnce || expressions.length === 0 || expressions.every((e) => isStaticExpression(e, this.root.options.bindingMetadata))) return this.registerOperation(...operations);
|
|
24851
|
-
this.block.effect.
|
|
25026
|
+
const index = getIndex ? getIndex() : this.block.effect.length;
|
|
25027
|
+
this.block.effect.splice(index, 0, {
|
|
24852
25028
|
expressions,
|
|
24853
25029
|
operations
|
|
24854
25030
|
});
|
|
25031
|
+
if (getIndex) this.shiftEffectBoundaries(index);
|
|
24855
25032
|
}
|
|
24856
25033
|
registerOperation(...node) {
|
|
24857
25034
|
this.block.operation.push(...node);
|
|
24858
25035
|
}
|
|
25036
|
+
effectBoundary() {
|
|
25037
|
+
return {
|
|
25038
|
+
operationIndex: this.operationIndex,
|
|
25039
|
+
effectIndex: this.effectIndex
|
|
25040
|
+
};
|
|
25041
|
+
}
|
|
24859
25042
|
create(node, index) {
|
|
24860
25043
|
let effectiveParent = this;
|
|
24861
25044
|
while (effectiveParent && effectiveParent.node.type === 1 && effectiveParent.node.tagType === 3) effectiveParent = effectiveParent.parent;
|
|
24862
25045
|
const isLastEffectiveChild = this.isEffectivelyLastChild(index);
|
|
24863
25046
|
const isOnRightmostPath = this.isOnRightmostPath && isLastEffectiveChild;
|
|
24864
|
-
let hasInlineAncestorNeedingClose = this.hasInlineAncestorNeedingClose;
|
|
24865
|
-
if (this.node.type === 1) {
|
|
24866
|
-
if (this.node.tag === "template") hasInlineAncestorNeedingClose = false;
|
|
24867
|
-
else if (!hasInlineAncestorNeedingClose && !this.isOnRightmostPath && isInlineTag(this.node.tag)) hasInlineAncestorNeedingClose = true;
|
|
24868
|
-
}
|
|
24869
25047
|
return Object.assign(Object.create(TransformContext.prototype), this, {
|
|
24870
25048
|
node,
|
|
24871
25049
|
parent: this,
|
|
24872
25050
|
index,
|
|
24873
25051
|
template: "",
|
|
25052
|
+
templateRoot: false,
|
|
24874
25053
|
childrenTemplate: [],
|
|
25054
|
+
templateIndexMap: this.templateIndexMap,
|
|
24875
25055
|
dynamic: newDynamic(),
|
|
25056
|
+
effectIndex: this.block.effect.length,
|
|
25057
|
+
operationIndex: this.block.operation.length,
|
|
24876
25058
|
effectiveParent,
|
|
24877
25059
|
isLastEffectiveChild,
|
|
24878
25060
|
isOnRightmostPath,
|
|
24879
|
-
|
|
25061
|
+
templateCloseTags: this.templateCloseTags,
|
|
25062
|
+
templateCloseBlocks: this.templateCloseBlocks
|
|
24880
25063
|
});
|
|
24881
25064
|
}
|
|
25065
|
+
shiftEffectBoundaries(index, dynamic = this.dynamic) {
|
|
25066
|
+
const operation = dynamic.operation;
|
|
25067
|
+
if (operation && isBlockOperation(operation) && operation.effectIndex !== void 0 && operation.effectIndex >= index) operation.effectIndex++;
|
|
25068
|
+
for (const child of dynamic.children) this.shiftEffectBoundaries(index, child);
|
|
25069
|
+
}
|
|
24882
25070
|
isEffectivelyLastChild(index) {
|
|
24883
25071
|
const children = this.node.children;
|
|
24884
25072
|
if (!children) return true;
|
|
@@ -24913,9 +25101,7 @@ function transform(node, options = {}) {
|
|
|
24913
25101
|
type: 0,
|
|
24914
25102
|
node,
|
|
24915
25103
|
source: node.source,
|
|
24916
|
-
template:
|
|
24917
|
-
templateIndexMap: /* @__PURE__ */ new Map(),
|
|
24918
|
-
rootTemplateIndexes: /* @__PURE__ */ new Set(),
|
|
25104
|
+
template: new TemplateRegistry(),
|
|
24919
25105
|
component: /* @__PURE__ */ new Set(),
|
|
24920
25106
|
directive: /* @__PURE__ */ new Set(),
|
|
24921
25107
|
block: newBlock(node),
|
|
@@ -25066,6 +25252,9 @@ function genCall(name, ...frags) {
|
|
|
25066
25252
|
hasPlaceholder ? name[1] : "null"
|
|
25067
25253
|
], ...frags)];
|
|
25068
25254
|
}
|
|
25255
|
+
function getParserOptions(plugins) {
|
|
25256
|
+
return { plugins: plugins ? plugins.some((plugin) => plugin === "typescript") ? plugins : [...plugins, "typescript"] : ["typescript"] };
|
|
25257
|
+
}
|
|
25069
25258
|
function codeFragmentToString(code, context) {
|
|
25070
25259
|
const { options: { filename, sourceMap } } = context;
|
|
25071
25260
|
let map;
|
|
@@ -25129,82 +25318,6 @@ function codeFragmentToString(code, context) {
|
|
|
25129
25318
|
}
|
|
25130
25319
|
}
|
|
25131
25320
|
//#endregion
|
|
25132
|
-
//#region packages/compiler-vapor/src/ir/component.ts
|
|
25133
|
-
const IRDynamicPropsKind = {
|
|
25134
|
-
"EXPRESSION": 0,
|
|
25135
|
-
"0": "EXPRESSION",
|
|
25136
|
-
"ATTRIBUTE": 1,
|
|
25137
|
-
"1": "ATTRIBUTE"
|
|
25138
|
-
};
|
|
25139
|
-
const IRSlotType = {
|
|
25140
|
-
"STATIC": 0,
|
|
25141
|
-
"0": "STATIC",
|
|
25142
|
-
"DYNAMIC": 1,
|
|
25143
|
-
"1": "DYNAMIC",
|
|
25144
|
-
"LOOP": 2,
|
|
25145
|
-
"2": "LOOP",
|
|
25146
|
-
"CONDITIONAL": 3,
|
|
25147
|
-
"3": "CONDITIONAL",
|
|
25148
|
-
"EXPRESSION": 4,
|
|
25149
|
-
"4": "EXPRESSION"
|
|
25150
|
-
};
|
|
25151
|
-
//#endregion
|
|
25152
|
-
//#region packages/compiler-vapor/src/ir/index.ts
|
|
25153
|
-
const IRNodeTypes = {
|
|
25154
|
-
"ROOT": 0,
|
|
25155
|
-
"0": "ROOT",
|
|
25156
|
-
"BLOCK": 1,
|
|
25157
|
-
"1": "BLOCK",
|
|
25158
|
-
"SET_BLOCK_KEY": 2,
|
|
25159
|
-
"2": "SET_BLOCK_KEY",
|
|
25160
|
-
"SET_PROP": 3,
|
|
25161
|
-
"3": "SET_PROP",
|
|
25162
|
-
"SET_DYNAMIC_PROPS": 4,
|
|
25163
|
-
"4": "SET_DYNAMIC_PROPS",
|
|
25164
|
-
"SET_TEXT": 5,
|
|
25165
|
-
"5": "SET_TEXT",
|
|
25166
|
-
"SET_EVENT": 6,
|
|
25167
|
-
"6": "SET_EVENT",
|
|
25168
|
-
"SET_DYNAMIC_EVENTS": 7,
|
|
25169
|
-
"7": "SET_DYNAMIC_EVENTS",
|
|
25170
|
-
"SET_HTML": 8,
|
|
25171
|
-
"8": "SET_HTML",
|
|
25172
|
-
"SET_TEMPLATE_REF": 9,
|
|
25173
|
-
"9": "SET_TEMPLATE_REF",
|
|
25174
|
-
"INSERT_NODE": 10,
|
|
25175
|
-
"10": "INSERT_NODE",
|
|
25176
|
-
"PREPEND_NODE": 11,
|
|
25177
|
-
"11": "PREPEND_NODE",
|
|
25178
|
-
"CREATE_COMPONENT_NODE": 12,
|
|
25179
|
-
"12": "CREATE_COMPONENT_NODE",
|
|
25180
|
-
"SLOT_OUTLET_NODE": 13,
|
|
25181
|
-
"13": "SLOT_OUTLET_NODE",
|
|
25182
|
-
"DIRECTIVE": 14,
|
|
25183
|
-
"14": "DIRECTIVE",
|
|
25184
|
-
"IF": 15,
|
|
25185
|
-
"15": "IF",
|
|
25186
|
-
"FOR": 16,
|
|
25187
|
-
"16": "FOR",
|
|
25188
|
-
"KEY": 17,
|
|
25189
|
-
"17": "KEY",
|
|
25190
|
-
"GET_TEXT_CHILD": 18,
|
|
25191
|
-
"18": "GET_TEXT_CHILD"
|
|
25192
|
-
};
|
|
25193
|
-
const DynamicFlag = {
|
|
25194
|
-
"NONE": 0,
|
|
25195
|
-
"0": "NONE",
|
|
25196
|
-
"REFERENCED": 1,
|
|
25197
|
-
"1": "REFERENCED",
|
|
25198
|
-
"NON_TEMPLATE": 2,
|
|
25199
|
-
"2": "NON_TEMPLATE",
|
|
25200
|
-
"INSERT": 4,
|
|
25201
|
-
"4": "INSERT"
|
|
25202
|
-
};
|
|
25203
|
-
function isBlockOperation(op) {
|
|
25204
|
-
const type = op.type;
|
|
25205
|
-
return type === 12 || type === 13 || type === 15 || type === 17 || type === 16;
|
|
25206
|
-
}
|
|
25207
|
-
//#endregion
|
|
25208
25321
|
//#region packages/compiler-vapor/src/generators/dom.ts
|
|
25209
25322
|
function genInsertNode({ parent, elements, anchor }, { helper }) {
|
|
25210
25323
|
let element = elements.map((el) => `n${el}`).join(", ");
|
|
@@ -25524,9 +25637,7 @@ function escapeRegExp(string) {
|
|
|
25524
25637
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25525
25638
|
}
|
|
25526
25639
|
function parseExp(context, content) {
|
|
25527
|
-
|
|
25528
|
-
const options = { plugins: plugins ? [...plugins, "typescript"] : ["typescript"] };
|
|
25529
|
-
return (0, import_lib.parseExpression)(`(${content})`, options);
|
|
25640
|
+
return (0, import_lib.parseExpression)(`(${content})`, getParserOptions(context.options.expressionPlugins));
|
|
25530
25641
|
}
|
|
25531
25642
|
function genVarName(exp) {
|
|
25532
25643
|
return `${exp.replace(/[^a-zA-Z0-9]/g, "_").replace(/_+/g, "_").replace(/_+$/, "")}`;
|
|
@@ -25704,16 +25815,12 @@ function genFor(oper, context) {
|
|
|
25704
25815
|
idMap[rawIndex] = `${indexVar}.value`;
|
|
25705
25816
|
idMap[indexVar] = null;
|
|
25706
25817
|
}
|
|
25707
|
-
const { selectorPatterns, keyOnlyBindingPatterns } = matchPatterns(render, keyProp, idMap);
|
|
25818
|
+
const { selectorPatterns, keyOnlyBindingPatterns } = matchPatterns(render, keyProp, idMap, context);
|
|
25708
25819
|
const selectorDeclarations = [];
|
|
25709
|
-
const
|
|
25820
|
+
const selectorName = (i) => selectorPatterns.length > 1 ? `_selector${id}_${i}` : `_selector${id}`;
|
|
25710
25821
|
for (let i = 0; i < selectorPatterns.length; i++) {
|
|
25711
25822
|
const { selector } = selectorPatterns[i];
|
|
25712
|
-
const selectorName = `
|
|
25713
|
-
selectorDeclarations.push(`let ${selectorName}`, NEWLINE);
|
|
25714
|
-
if (i === 0) selectorSetup.push(`({ createSelector }) => {`, INDENT_START);
|
|
25715
|
-
selectorSetup.push(NEWLINE, `${selectorName} = `, ...genCall(`createSelector`, [`() => `, ...genExpression(selector, context)]));
|
|
25716
|
-
if (i === selectorPatterns.length - 1) selectorSetup.push(INDENT_END, NEWLINE, "}");
|
|
25823
|
+
selectorDeclarations.push(`const ${selectorName(i)} = `, ...genCall(helper("createSelector"), [`() => `, ...genExpression(selector, context)]), NEWLINE);
|
|
25717
25824
|
}
|
|
25718
25825
|
const blockFn = context.withId(() => {
|
|
25719
25826
|
const frag = [];
|
|
@@ -25722,7 +25829,7 @@ function genFor(oper, context) {
|
|
|
25722
25829
|
const patternFrag = [];
|
|
25723
25830
|
for (let i = 0; i < selectorPatterns.length; i++) {
|
|
25724
25831
|
const { effect } = selectorPatterns[i];
|
|
25725
|
-
patternFrag.push(NEWLINE,
|
|
25832
|
+
patternFrag.push(NEWLINE, `${selectorName(i)}(`, ...genExpression(keyProp, context), `, () => {`, INDENT_START);
|
|
25726
25833
|
for (const oper of effect.operations) patternFrag.push(...genOperation(oper, context));
|
|
25727
25834
|
patternFrag.push(INDENT_END, NEWLINE, `})`);
|
|
25728
25835
|
}
|
|
@@ -25738,11 +25845,14 @@ function genFor(oper, context) {
|
|
|
25738
25845
|
if (onlyChild) flags |= 1;
|
|
25739
25846
|
if (component) flags |= 2;
|
|
25740
25847
|
if (once) flags |= 4;
|
|
25848
|
+
const onResetCalls = [];
|
|
25849
|
+
for (let i = 0; i < selectorPatterns.length; i++) onResetCalls.push(NEWLINE, `n${id}.onReset(${selectorName(i)}.reset)`);
|
|
25741
25850
|
return [
|
|
25742
25851
|
NEWLINE,
|
|
25743
25852
|
...selectorDeclarations,
|
|
25744
25853
|
`const n${id} = `,
|
|
25745
|
-
...genCall([helper("createFor"), "undefined"], sourceExpr, blockFn, genCallback(keyProp), flags ? String(flags) : void 0,
|
|
25854
|
+
...genCall([helper("createFor"), "undefined"], sourceExpr, blockFn, genCallback(keyProp), flags ? String(flags) : void 0),
|
|
25855
|
+
...onResetCalls
|
|
25746
25856
|
];
|
|
25747
25857
|
function genCallback(expr) {
|
|
25748
25858
|
if (!expr) return false;
|
|
@@ -25828,35 +25938,49 @@ function buildDestructureIdMap(idToPathMap, baseAccessor, plugins) {
|
|
|
25828
25938
|
}
|
|
25829
25939
|
if (pathInfo.dynamic) {
|
|
25830
25940
|
const node = idMap[id] = createSimpleExpression(path);
|
|
25831
|
-
node.ast = (0, import_lib.parseExpression)(`(${path})`,
|
|
25941
|
+
node.ast = (0, import_lib.parseExpression)(`(${path})`, getParserOptions(plugins));
|
|
25832
25942
|
} else idMap[id] = path;
|
|
25833
25943
|
} else idMap[id] = path;
|
|
25834
25944
|
});
|
|
25835
25945
|
return idMap;
|
|
25836
25946
|
}
|
|
25837
|
-
function matchPatterns(render, keyProp, idMap) {
|
|
25947
|
+
function matchPatterns(render, keyProp, idMap, context) {
|
|
25838
25948
|
const selectorPatterns = [];
|
|
25839
25949
|
const keyOnlyBindingPatterns = [];
|
|
25840
|
-
|
|
25950
|
+
const removedEffectIndexes = [];
|
|
25951
|
+
render.effect = render.effect.filter((effect, index) => {
|
|
25841
25952
|
if (keyProp !== void 0) {
|
|
25842
|
-
const selector = matchSelectorPattern(effect, keyProp.content, idMap);
|
|
25953
|
+
const selector = matchSelectorPattern(effect, keyProp.content, idMap, context);
|
|
25843
25954
|
if (selector) {
|
|
25844
25955
|
selectorPatterns.push(selector);
|
|
25956
|
+
removedEffectIndexes.push(index);
|
|
25845
25957
|
return false;
|
|
25846
25958
|
}
|
|
25847
25959
|
const keyOnly = matchKeyOnlyBindingPattern(effect, keyProp.content);
|
|
25848
25960
|
if (keyOnly) {
|
|
25849
25961
|
keyOnlyBindingPatterns.push(keyOnly);
|
|
25962
|
+
removedEffectIndexes.push(index);
|
|
25850
25963
|
return false;
|
|
25851
25964
|
}
|
|
25852
25965
|
}
|
|
25853
25966
|
return true;
|
|
25854
25967
|
});
|
|
25968
|
+
if (removedEffectIndexes.length) shiftEffectBoundaries(render.dynamic, removedEffectIndexes);
|
|
25855
25969
|
return {
|
|
25856
25970
|
keyOnlyBindingPatterns,
|
|
25857
25971
|
selectorPatterns
|
|
25858
25972
|
};
|
|
25859
25973
|
}
|
|
25974
|
+
function shiftEffectBoundaries(dynamic, removedEffectIndexes) {
|
|
25975
|
+
const operation = dynamic.operation;
|
|
25976
|
+
if (operation && isBlockOperation(operation) && operation.effectIndex !== void 0) {
|
|
25977
|
+
let offset = 0;
|
|
25978
|
+
for (const removedIndex of removedEffectIndexes) if (removedIndex < operation.effectIndex) offset++;
|
|
25979
|
+
else break;
|
|
25980
|
+
operation.effectIndex -= offset;
|
|
25981
|
+
}
|
|
25982
|
+
for (const child of dynamic.children) shiftEffectBoundaries(child, removedEffectIndexes);
|
|
25983
|
+
}
|
|
25860
25984
|
function matchKeyOnlyBindingPattern(effect, key) {
|
|
25861
25985
|
if (effect.expressions.length === 1) {
|
|
25862
25986
|
const { ast, content } = effect.expressions[0];
|
|
@@ -25865,7 +25989,7 @@ function matchKeyOnlyBindingPattern(effect, key) {
|
|
|
25865
25989
|
}
|
|
25866
25990
|
}
|
|
25867
25991
|
}
|
|
25868
|
-
function matchSelectorPattern(effect, key, idMap) {
|
|
25992
|
+
function matchSelectorPattern(effect, key, idMap, context) {
|
|
25869
25993
|
if (effect.expressions.length === 1) {
|
|
25870
25994
|
const { ast, content } = effect.expressions[0];
|
|
25871
25995
|
if (typeof ast === "object" && ast) {
|
|
@@ -25890,17 +26014,11 @@ function matchSelectorPattern(effect, key, idMap) {
|
|
|
25890
26014
|
}, false);
|
|
25891
26015
|
if (!hasExtraId) {
|
|
25892
26016
|
const name = content.slice(selector.start - 1, selector.end - 1);
|
|
26017
|
+
const selectorExpression = createSimpleExpression(name, false, selector.loc);
|
|
26018
|
+
selectorExpression.ast = (0, import_lib.parseExpression)(`(${name})`, getParserOptions(context.options.expressionPlugins));
|
|
25893
26019
|
return {
|
|
25894
26020
|
effect,
|
|
25895
|
-
selector:
|
|
25896
|
-
content: name,
|
|
25897
|
-
ast: extend({}, selector, {
|
|
25898
|
-
start: 1,
|
|
25899
|
-
end: name.length + 1
|
|
25900
|
-
}),
|
|
25901
|
-
loc: selector.loc,
|
|
25902
|
-
isStatic: false
|
|
25903
|
-
}
|
|
26021
|
+
selector: selectorExpression
|
|
25904
26022
|
};
|
|
25905
26023
|
}
|
|
25906
26024
|
}
|
|
@@ -25962,6 +26080,7 @@ const helpers = {
|
|
|
25962
26080
|
setText: { name: "setText" },
|
|
25963
26081
|
setHtml: { name: "setHtml" },
|
|
25964
26082
|
setClass: { name: "setClass" },
|
|
26083
|
+
setClassName: { name: "setClassName" },
|
|
25965
26084
|
setStyle: { name: "setStyle" },
|
|
25966
26085
|
setValue: { name: "setValue" },
|
|
25967
26086
|
setAttr: {
|
|
@@ -25981,9 +26100,132 @@ function genSetProp(oper, context) {
|
|
|
25981
26100
|
const { helper } = context;
|
|
25982
26101
|
const { prop: { key, values, modifier }, tag } = oper;
|
|
25983
26102
|
const resolvedHelper = getRuntimeHelper(tag, key.content, modifier);
|
|
26103
|
+
if (key.content === "class" && !resolvedHelper.isSVG && resolvedHelper.name === "setClass") {
|
|
26104
|
+
const className = genSetClassName(oper, context);
|
|
26105
|
+
if (className) return className;
|
|
26106
|
+
}
|
|
25984
26107
|
const propValue = genPropValue(values, context);
|
|
25985
26108
|
return [NEWLINE, ...genCall([helper(resolvedHelper.name), null], `n${oper.element}`, resolvedHelper.needKey ? genExpression(key, context) : false, propValue, resolvedHelper.isSVG && "true")];
|
|
25986
26109
|
}
|
|
26110
|
+
const MAX_CLASS_NAME_ENTRIES = 31;
|
|
26111
|
+
function genSetClassName(oper, context) {
|
|
26112
|
+
const info = resolveClassName(oper.prop.values, context);
|
|
26113
|
+
if (!info) return;
|
|
26114
|
+
const { helper } = context;
|
|
26115
|
+
const flags = genClassFlags(info.entries, context);
|
|
26116
|
+
const classFragments = info.entries.map((entry) => JSON.stringify(!info.prefix && info.entries.length === 1 ? entry.className : ` ${entry.className}`));
|
|
26117
|
+
const fragments = classFragments.length === 1 ? classFragments[0] : genMulti(DELIMITERS_ARRAY, ...classFragments);
|
|
26118
|
+
return [NEWLINE, ...genCall([helper("setClassName"), "\"\""], `n${oper.element}`, flags, fragments, info.prefix && JSON.stringify(info.prefix), info.suffix && JSON.stringify(info.suffix))];
|
|
26119
|
+
}
|
|
26120
|
+
function resolveClassName(values, context) {
|
|
26121
|
+
let prefix = "";
|
|
26122
|
+
let suffix = "";
|
|
26123
|
+
const entries = [];
|
|
26124
|
+
let sawDynamic = false;
|
|
26125
|
+
let sawSuffix = false;
|
|
26126
|
+
for (const value of values) {
|
|
26127
|
+
const staticValue = getLiteralExpressionValue(value, true);
|
|
26128
|
+
if (staticValue != null) {
|
|
26129
|
+
const normalized = normalizeClass(staticValue);
|
|
26130
|
+
if (normalized) if (sawSuffix) suffix = appendClass(suffix, normalized);
|
|
26131
|
+
else if (sawDynamic) {
|
|
26132
|
+
sawSuffix = true;
|
|
26133
|
+
suffix = appendClass(suffix, normalized);
|
|
26134
|
+
} else prefix = appendClass(prefix, normalized);
|
|
26135
|
+
continue;
|
|
26136
|
+
}
|
|
26137
|
+
const ast = value.ast;
|
|
26138
|
+
if (!ast || sawSuffix) return;
|
|
26139
|
+
sawDynamic = true;
|
|
26140
|
+
if (ast.type === "ObjectExpression") {
|
|
26141
|
+
if (!resolveObjectClassName(value, ast, entries, context)) return;
|
|
26142
|
+
} else if (ast.type === "ConditionalExpression") {
|
|
26143
|
+
if (!resolveConditionalClassName(value, ast, entries, context)) return;
|
|
26144
|
+
} else return;
|
|
26145
|
+
}
|
|
26146
|
+
return entries.length && entries.length <= MAX_CLASS_NAME_ENTRIES ? {
|
|
26147
|
+
prefix,
|
|
26148
|
+
suffix,
|
|
26149
|
+
entries
|
|
26150
|
+
} : void 0;
|
|
26151
|
+
}
|
|
26152
|
+
function resolveObjectClassName(source, ast, entries, context) {
|
|
26153
|
+
for (const prop of ast.properties) {
|
|
26154
|
+
if (prop.type !== "ObjectProperty" || prop.computed) return false;
|
|
26155
|
+
const rawClassName = getObjectPropertyName(prop);
|
|
26156
|
+
if (rawClassName == null) return false;
|
|
26157
|
+
const className = normalizeClass(rawClassName);
|
|
26158
|
+
if (!className) continue;
|
|
26159
|
+
const value = getBooleanValue(prop.value);
|
|
26160
|
+
entries.push({
|
|
26161
|
+
className,
|
|
26162
|
+
value,
|
|
26163
|
+
condition: value == null ? createSubExpression(source, prop.value, context) : void 0
|
|
26164
|
+
});
|
|
26165
|
+
}
|
|
26166
|
+
return true;
|
|
26167
|
+
}
|
|
26168
|
+
function resolveConditionalClassName(source, ast, entries, context) {
|
|
26169
|
+
const consequent = getStringClassValue(ast.consequent);
|
|
26170
|
+
const alternate = getStringClassValue(ast.alternate);
|
|
26171
|
+
if (consequent && alternate === "") {
|
|
26172
|
+
entries.push({
|
|
26173
|
+
className: consequent,
|
|
26174
|
+
condition: createSubExpression(source, ast.test, context)
|
|
26175
|
+
});
|
|
26176
|
+
return true;
|
|
26177
|
+
} else if (alternate && consequent === "") {
|
|
26178
|
+
entries.push({
|
|
26179
|
+
className: alternate,
|
|
26180
|
+
condition: createSubExpression(source, ast.test, context),
|
|
26181
|
+
negate: true
|
|
26182
|
+
});
|
|
26183
|
+
return true;
|
|
26184
|
+
}
|
|
26185
|
+
return false;
|
|
26186
|
+
}
|
|
26187
|
+
function genClassFlags(entries, context) {
|
|
26188
|
+
const values = [];
|
|
26189
|
+
entries.forEach((entry, index) => {
|
|
26190
|
+
if (index) values.push(" | ");
|
|
26191
|
+
const bit = 1 << index;
|
|
26192
|
+
if (entry.value != null) {
|
|
26193
|
+
values.push(entry.value ? String(bit) : "0");
|
|
26194
|
+
return;
|
|
26195
|
+
}
|
|
26196
|
+
values.push("(", ...genExpression(entry.condition, context), entry.negate ? ` ? 0 : ${bit}` : ` ? ${bit} : 0`, ")");
|
|
26197
|
+
});
|
|
26198
|
+
return values;
|
|
26199
|
+
}
|
|
26200
|
+
function appendClass(base, value) {
|
|
26201
|
+
return base ? value ? `${base} ${value}` : base : value;
|
|
26202
|
+
}
|
|
26203
|
+
function getObjectPropertyName(prop) {
|
|
26204
|
+
const key = prop.key;
|
|
26205
|
+
if (key.type === "Identifier") return key.name;
|
|
26206
|
+
else if (key.type === "StringLiteral") return key.value;
|
|
26207
|
+
else if (key.type === "NumericLiteral") return String(key.value);
|
|
26208
|
+
}
|
|
26209
|
+
function getStringClassValue(node) {
|
|
26210
|
+
if (node.type === "StringLiteral") return normalizeClass(node.value);
|
|
26211
|
+
else if (node.type === "TemplateLiteral" && node.expressions.length === 0) return normalizeClass(node.quasis[0].value.cooked || "");
|
|
26212
|
+
else if (node.type === "NullLiteral" || node.type === "BooleanLiteral" && !node.value) return "";
|
|
26213
|
+
}
|
|
26214
|
+
function getBooleanValue(node) {
|
|
26215
|
+
if (node.type === "BooleanLiteral") return node.value;
|
|
26216
|
+
}
|
|
26217
|
+
function createSubExpression(source, node, context) {
|
|
26218
|
+
const start = node.start == null ? 0 : node.start - 1;
|
|
26219
|
+
const end = node.end == null ? source.content.length : node.end - 1;
|
|
26220
|
+
const content = source.content.slice(start, end);
|
|
26221
|
+
const expression = createSimpleExpression(content, false, {
|
|
26222
|
+
start: advancePositionWithClone(source.loc.start, source.content, start),
|
|
26223
|
+
end: advancePositionWithClone(source.loc.start, source.content, end),
|
|
26224
|
+
source: content
|
|
26225
|
+
});
|
|
26226
|
+
expression.ast = isSimpleIdentifier(content) ? null : (0, import_lib.parseExpression)(`(${content})`, getParserOptions(context.options.expressionPlugins));
|
|
26227
|
+
return expression;
|
|
26228
|
+
}
|
|
25987
26229
|
function genDynamicProps$1(oper, context) {
|
|
25988
26230
|
const { helper } = context;
|
|
25989
26231
|
const isSVG = isSVGTag(oper.tag);
|
|
@@ -26172,11 +26414,11 @@ function genCreateComponent(operation, context) {
|
|
|
26172
26414
|
];
|
|
26173
26415
|
}, []),
|
|
26174
26416
|
`const n${operation.id} = `,
|
|
26175
|
-
...genCall(operation.dynamic && !operation.dynamic.isStatic ? helper("createDynamicComponent") : operation.
|
|
26417
|
+
...genCall(operation.dynamic && !operation.dynamic.isStatic ? helper("createDynamicComponent") : operation.useCreateElement ? helper("createPlainElement") : operation.asset ? helper("createComponentWithFallback") : helper("createComponent"), tag, rawProps, rawSlots, root ? "true" : false, once && "true"),
|
|
26176
26418
|
...genDirectivesForElement(operation.id, context)
|
|
26177
26419
|
];
|
|
26178
26420
|
function genTag() {
|
|
26179
|
-
if (operation.
|
|
26421
|
+
if (operation.useCreateElement) return JSON.stringify(operation.tag);
|
|
26180
26422
|
else if (operation.dynamic) if (operation.dynamic.isStatic) return genCall(helper("resolveDynamicComponent"), genExpression(operation.dynamic, context));
|
|
26181
26423
|
else return [
|
|
26182
26424
|
"() => (",
|
|
@@ -26393,11 +26635,23 @@ function genDynamicSlot(slot, context, withFunction = false) {
|
|
|
26393
26635
|
frag = genConditionalSlot(slot, context);
|
|
26394
26636
|
break;
|
|
26395
26637
|
}
|
|
26396
|
-
|
|
26638
|
+
if (!withFunction) return frag;
|
|
26639
|
+
return needsDynamicSlotSourceCtx(slot) ? [
|
|
26640
|
+
`${context.helper("withVaporCtx")}(() => (`,
|
|
26641
|
+
...frag,
|
|
26642
|
+
"))"
|
|
26643
|
+
] : [
|
|
26397
26644
|
"() => (",
|
|
26398
26645
|
...frag,
|
|
26399
26646
|
")"
|
|
26400
|
-
]
|
|
26647
|
+
];
|
|
26648
|
+
}
|
|
26649
|
+
function needsDynamicSlotSourceCtx(slot) {
|
|
26650
|
+
switch (slot.slotType) {
|
|
26651
|
+
case 1: return needsVaporCtx(slot.fn);
|
|
26652
|
+
case 2: return needsVaporCtx(slot.fn);
|
|
26653
|
+
case 3: return needsDynamicSlotSourceCtx(slot.positive) || (slot.negative ? needsDynamicSlotSourceCtx(slot.negative) : false);
|
|
26654
|
+
}
|
|
26401
26655
|
}
|
|
26402
26656
|
function genBasicDynamicSlot(slot, context) {
|
|
26403
26657
|
const { name, fn } = slot;
|
|
@@ -26612,21 +26866,24 @@ function genEffect({ operations }, context) {
|
|
|
26612
26866
|
return frag;
|
|
26613
26867
|
}
|
|
26614
26868
|
function genInsertionState(operation, context) {
|
|
26615
|
-
const { parent, anchor, logicalIndex, append
|
|
26616
|
-
return [NEWLINE, ...genCall(context.helper("setInsertionState"), `n${parent}`, anchor == null ? void 0 : anchor === -1 ? `0` : append ? "null" : `n${anchor}`, logicalIndex !== void 0 ? String(logicalIndex) : void 0
|
|
26869
|
+
const { parent, anchor, logicalIndex, append } = operation;
|
|
26870
|
+
return [NEWLINE, ...genCall(context.helper("setInsertionState"), `n${parent}`, anchor == null ? void 0 : anchor === -1 ? `0` : append ? "null" : `n${anchor}`, logicalIndex !== void 0 ? String(logicalIndex) : void 0)];
|
|
26617
26871
|
}
|
|
26618
26872
|
//#endregion
|
|
26619
26873
|
//#region packages/compiler-vapor/src/generators/template.ts
|
|
26620
|
-
function genTemplates(templates,
|
|
26874
|
+
function genTemplates(templates, context) {
|
|
26621
26875
|
const result = [];
|
|
26622
|
-
|
|
26623
|
-
|
|
26624
|
-
|
|
26625
|
-
|
|
26876
|
+
templates.forEach(({ content, ns, root, static: isStatic }, i) => {
|
|
26877
|
+
let args = JSON.stringify(content).replace(IMPORT_EXPR_RE, `" + $1 + "`);
|
|
26878
|
+
if (root) args += ", true";
|
|
26879
|
+
else if (isStatic || ns) args += ", false";
|
|
26880
|
+
if (isStatic || ns) args += `, ${isStatic ? "true" : "false"}`;
|
|
26881
|
+
if (ns) args += `, ${ns}`;
|
|
26882
|
+
result.push(`const ${context.tName(i)} = ${context.helper("template")}(${args})\n`);
|
|
26626
26883
|
});
|
|
26627
26884
|
return result.join("");
|
|
26628
26885
|
}
|
|
26629
|
-
function genSelf(dynamic, context) {
|
|
26886
|
+
function genSelf(dynamic, context, flushBeforeDynamic) {
|
|
26630
26887
|
const [frag, push] = buildCodeFragment();
|
|
26631
26888
|
const { id, template, operation, hasDynamicChild } = dynamic;
|
|
26632
26889
|
if (id !== void 0 && template !== void 0) {
|
|
@@ -26634,10 +26891,10 @@ function genSelf(dynamic, context) {
|
|
|
26634
26891
|
push(...genDirectivesForElement(id, context));
|
|
26635
26892
|
}
|
|
26636
26893
|
if (operation) push(...genOperationWithInsertionState(operation, context));
|
|
26637
|
-
if (hasDynamicChild) push(...genChildren(dynamic, context, push, `n${id}
|
|
26894
|
+
if (hasDynamicChild) push(...genChildren(dynamic, context, push, `n${id}`, flushBeforeDynamic));
|
|
26638
26895
|
return frag;
|
|
26639
26896
|
}
|
|
26640
|
-
function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}
|
|
26897
|
+
function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flushBeforeDynamic) {
|
|
26641
26898
|
const { helper } = context;
|
|
26642
26899
|
const [frag, push] = buildCodeFragment();
|
|
26643
26900
|
const { children } = dynamic;
|
|
@@ -26646,12 +26903,14 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
|
|
|
26646
26903
|
for (const [index, child] of children.entries()) {
|
|
26647
26904
|
if (child.flags & 2) offset--;
|
|
26648
26905
|
if (child.flags & 4 && child.template != null) {
|
|
26649
|
-
|
|
26906
|
+
flushBeforeDynamic && flushBeforeDynamic(child, push);
|
|
26907
|
+
push(...genSelf(child, context, flushBeforeDynamic));
|
|
26650
26908
|
continue;
|
|
26651
26909
|
}
|
|
26652
26910
|
const id = child.flags & 1 ? child.flags & 4 ? child.anchor : child.id : void 0;
|
|
26653
26911
|
if (id === void 0 && !child.hasDynamicChild) {
|
|
26654
|
-
|
|
26912
|
+
flushBeforeDynamic && flushBeforeDynamic(child, push);
|
|
26913
|
+
push(...genSelf(child, context, flushBeforeDynamic));
|
|
26655
26914
|
continue;
|
|
26656
26915
|
}
|
|
26657
26916
|
const elementIndex = index + offset;
|
|
@@ -26667,10 +26926,13 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
|
|
|
26667
26926
|
else if (elementIndex > 1) init = genCall(helper("nthChild"), from, String(elementIndex), logicalIndex);
|
|
26668
26927
|
pushBlock(...init);
|
|
26669
26928
|
}
|
|
26670
|
-
if (id === child.anchor && !child.hasDynamicChild)
|
|
26929
|
+
if (id === child.anchor && !child.hasDynamicChild) {
|
|
26930
|
+
flushBeforeDynamic && flushBeforeDynamic(child, push);
|
|
26931
|
+
push(...genSelf(child, context, flushBeforeDynamic));
|
|
26932
|
+
}
|
|
26671
26933
|
if (id !== void 0) push(...genDirectivesForElement(id, context));
|
|
26672
26934
|
prev = [variable, elementIndex];
|
|
26673
|
-
push(...genChildren(child, context, pushBlock, variable));
|
|
26935
|
+
push(...genChildren(child, context, pushBlock, variable, flushBeforeDynamic));
|
|
26674
26936
|
}
|
|
26675
26937
|
return frag;
|
|
26676
26938
|
}
|
|
@@ -26701,10 +26963,30 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
26701
26963
|
}
|
|
26702
26964
|
genResolveAssets("directive", "resolveDirective");
|
|
26703
26965
|
}
|
|
26704
|
-
|
|
26705
|
-
|
|
26706
|
-
|
|
26707
|
-
|
|
26966
|
+
let operationIndex = 0;
|
|
26967
|
+
let effectIndex = 0;
|
|
26968
|
+
const flushPendingOperations = (operationEnd, effectEnd, push) => {
|
|
26969
|
+
while (operationIndex < operationEnd) {
|
|
26970
|
+
push(...genOperationWithInsertionState(operation[operationIndex], context));
|
|
26971
|
+
operationIndex++;
|
|
26972
|
+
}
|
|
26973
|
+
if (effectIndex < effectEnd) {
|
|
26974
|
+
push(...genEffects(effect.slice(effectIndex, effectEnd), context));
|
|
26975
|
+
effectIndex = effectEnd;
|
|
26976
|
+
}
|
|
26977
|
+
};
|
|
26978
|
+
const flushBeforeDynamic = (dynamic, push) => {
|
|
26979
|
+
const operation = dynamic.operation;
|
|
26980
|
+
if (operation && isBlockOperation(operation) && operation.operationIndex !== void 0 && operation.effectIndex !== void 0) flushPendingOperations(operation.operationIndex, operation.effectIndex, push);
|
|
26981
|
+
};
|
|
26982
|
+
for (const child of dynamic.children) {
|
|
26983
|
+
flushBeforeDynamic(child, push);
|
|
26984
|
+
push(...genSelf(child, context, flushBeforeDynamic));
|
|
26985
|
+
}
|
|
26986
|
+
for (const child of dynamic.children) if (!child.hasDynamicChild) push(...genChildren(child, context, push, `n${child.id}`, flushBeforeDynamic));
|
|
26987
|
+
if (operationIndex < operation.length) push(...genOperations(operation.slice(operationIndex), context));
|
|
26988
|
+
if (effectIndex < effect.length) push(...genEffects(effect.slice(effectIndex), context, genEffectsExtraFrag));
|
|
26989
|
+
else if (genEffectsExtraFrag) push(...genEffects([], context, genEffectsExtraFrag));
|
|
26708
26990
|
push(NEWLINE, `return `);
|
|
26709
26991
|
const returnNodes = returns.map((n) => `n${n}`);
|
|
26710
26992
|
push(...returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "null"]);
|
|
@@ -26790,7 +27072,7 @@ var CodegenContext = class {
|
|
|
26790
27072
|
this.nextIdMap = /* @__PURE__ */ new Map();
|
|
26791
27073
|
this.lastIdMap = /* @__PURE__ */ new Map();
|
|
26792
27074
|
this.lastTIndex = -1;
|
|
26793
|
-
|
|
27075
|
+
const defaultOptions = {
|
|
26794
27076
|
mode: "module",
|
|
26795
27077
|
prefixIdentifiers: true,
|
|
26796
27078
|
sourceMap: false,
|
|
@@ -26805,7 +27087,8 @@ var CodegenContext = class {
|
|
|
26805
27087
|
inline: false,
|
|
26806
27088
|
bindingMetadata: {},
|
|
26807
27089
|
expressionPlugins: []
|
|
26808
|
-
}
|
|
27090
|
+
};
|
|
27091
|
+
this.options = extend(defaultOptions, options);
|
|
26809
27092
|
this.block = ir.block;
|
|
26810
27093
|
this.bindingNames = new Set(this.options.bindingMetadata ? Object.keys(this.options.bindingMetadata) : []);
|
|
26811
27094
|
this.initNextIdMap();
|
|
@@ -26826,7 +27109,7 @@ function generate(ir, options = {}) {
|
|
|
26826
27109
|
push(INDENT_END, NEWLINE);
|
|
26827
27110
|
if (!inline) push("}");
|
|
26828
27111
|
const delegates = genDelegates(context);
|
|
26829
|
-
const templates = genTemplates(ir.template
|
|
27112
|
+
const templates = genTemplates(ir.template.entries, context);
|
|
26830
27113
|
const preamble = genHelperImports(context) + genAssetImports(context) + templates + delegates;
|
|
26831
27114
|
const newlineCount = [...preamble].filter((c) => c === "\n").length;
|
|
26832
27115
|
if (newlineCount && !inline) frag.unshift(...new Array(newlineCount).fill(LF));
|
|
@@ -26858,79 +27141,6 @@ function genAssetImports({ ir }) {
|
|
|
26858
27141
|
return imports;
|
|
26859
27142
|
}
|
|
26860
27143
|
//#endregion
|
|
26861
|
-
//#region packages/compiler-vapor/src/transforms/transformChildren.ts
|
|
26862
|
-
const transformChildren = (node, context) => {
|
|
26863
|
-
const isFragment = node.type === 0 || node.type === 1 && (node.tagType === 3 || node.tagType === 1);
|
|
26864
|
-
if (!isFragment && node.type !== 1) return;
|
|
26865
|
-
for (const [i, child] of node.children.entries()) {
|
|
26866
|
-
const childContext = context.create(child, i);
|
|
26867
|
-
transformNode(childContext);
|
|
26868
|
-
const childDynamic = childContext.dynamic;
|
|
26869
|
-
if (isFragment) {
|
|
26870
|
-
childContext.reference();
|
|
26871
|
-
childContext.registerTemplate();
|
|
26872
|
-
if (!(childDynamic.flags & 2) || childDynamic.flags & 4) context.block.returns.push(childContext.dynamic.id);
|
|
26873
|
-
} else context.childrenTemplate.push(childContext.template);
|
|
26874
|
-
if (childDynamic.hasDynamicChild || childDynamic.id !== void 0 || childDynamic.flags & 2 || childDynamic.flags & 4) context.dynamic.hasDynamicChild = true;
|
|
26875
|
-
context.dynamic.children[i] = childDynamic;
|
|
26876
|
-
}
|
|
26877
|
-
if (!isFragment) processDynamicChildren(context);
|
|
26878
|
-
};
|
|
26879
|
-
function processDynamicChildren(context) {
|
|
26880
|
-
let prevDynamics = [];
|
|
26881
|
-
let staticCount = 0;
|
|
26882
|
-
let dynamicCount = 0;
|
|
26883
|
-
let lastInsertionChild;
|
|
26884
|
-
const children = context.dynamic.children;
|
|
26885
|
-
let logicalIndex = 0;
|
|
26886
|
-
for (const [index, child] of children.entries()) {
|
|
26887
|
-
if (child.flags & 4) {
|
|
26888
|
-
child.logicalIndex = logicalIndex;
|
|
26889
|
-
prevDynamics.push(lastInsertionChild = child);
|
|
26890
|
-
logicalIndex++;
|
|
26891
|
-
}
|
|
26892
|
-
if (!(child.flags & 2)) {
|
|
26893
|
-
child.logicalIndex = logicalIndex;
|
|
26894
|
-
if (prevDynamics.length) {
|
|
26895
|
-
if (staticCount) {
|
|
26896
|
-
context.childrenTemplate[index - prevDynamics.length] = `<!>`;
|
|
26897
|
-
prevDynamics[0].flags -= 2;
|
|
26898
|
-
const anchor = prevDynamics[0].anchor = context.increaseId();
|
|
26899
|
-
registerInsertion(prevDynamics, context, anchor);
|
|
26900
|
-
} else registerInsertion(prevDynamics, context, -1);
|
|
26901
|
-
dynamicCount += prevDynamics.length;
|
|
26902
|
-
prevDynamics = [];
|
|
26903
|
-
}
|
|
26904
|
-
staticCount++;
|
|
26905
|
-
logicalIndex++;
|
|
26906
|
-
}
|
|
26907
|
-
}
|
|
26908
|
-
if (prevDynamics.length) registerInsertion(prevDynamics, context, dynamicCount + staticCount, true);
|
|
26909
|
-
if (lastInsertionChild && lastInsertionChild.operation) lastInsertionChild.operation.last = true;
|
|
26910
|
-
}
|
|
26911
|
-
function registerInsertion(dynamics, context, anchor, append) {
|
|
26912
|
-
for (const child of dynamics) {
|
|
26913
|
-
const logicalIndex = child.logicalIndex;
|
|
26914
|
-
if (child.template != null) context.registerOperation({
|
|
26915
|
-
type: 10,
|
|
26916
|
-
elements: dynamics.map((child) => child.id),
|
|
26917
|
-
parent: context.reference(),
|
|
26918
|
-
anchor: append ? void 0 : anchor
|
|
26919
|
-
});
|
|
26920
|
-
else if (child.operation && isBlockOperation(child.operation)) {
|
|
26921
|
-
child.operation.parent = context.reference();
|
|
26922
|
-
child.operation.anchor = anchor;
|
|
26923
|
-
child.operation.logicalIndex = logicalIndex;
|
|
26924
|
-
child.operation.append = append;
|
|
26925
|
-
}
|
|
26926
|
-
}
|
|
26927
|
-
}
|
|
26928
|
-
//#endregion
|
|
26929
|
-
//#region packages/compiler-vapor/src/transforms/vOnce.ts
|
|
26930
|
-
const transformVOnce = (node, context) => {
|
|
26931
|
-
if (node.type === 1 && findDir$1(node, "once", true)) context.inVOnce = true;
|
|
26932
|
-
};
|
|
26933
|
-
//#endregion
|
|
26934
27144
|
//#region packages/compiler-vapor/src/transforms/vBind.ts
|
|
26935
27145
|
function normalizeBindShorthand(arg, context) {
|
|
26936
27146
|
if (arg.type !== 4 || !arg.isStatic) {
|
|
@@ -26968,6 +27178,7 @@ const transformVBind = (dir, node, context) => {
|
|
|
26968
27178
|
};
|
|
26969
27179
|
//#endregion
|
|
26970
27180
|
//#region packages/compiler-vapor/src/transforms/transformElement.ts
|
|
27181
|
+
init_objectSpread2();
|
|
26971
27182
|
const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,");
|
|
26972
27183
|
const transformElement = (node, context) => {
|
|
26973
27184
|
let effectIndex = context.block.effect.length;
|
|
@@ -26980,13 +27191,13 @@ const transformElement = (node, context) => {
|
|
|
26980
27191
|
return function postTransformElement() {
|
|
26981
27192
|
({node} = context);
|
|
26982
27193
|
if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) return;
|
|
26983
|
-
const
|
|
26984
|
-
const isComponent = node.tagType === 1 ||
|
|
27194
|
+
const useCreateElement = shouldUseCreateElement(node, context);
|
|
27195
|
+
const isComponent = node.tagType === 1 || useCreateElement;
|
|
26985
27196
|
const isDynamicComponent = isComponentTag(node.tag);
|
|
26986
27197
|
const staticKey = resolveStaticKey(node, context, isComponent);
|
|
26987
27198
|
const propsResult = buildProps(node, context, isComponent, isDynamicComponent, getEffectIndex);
|
|
26988
27199
|
const singleRoot = isSingleRoot(context);
|
|
26989
|
-
if (isComponent) transformComponentElement(node, propsResult, staticKey, singleRoot, context, isDynamicComponent,
|
|
27200
|
+
if (isComponent) transformComponentElement(node, propsResult, staticKey, singleRoot, context, isDynamicComponent, useCreateElement);
|
|
26990
27201
|
else transformNativeElement(node, propsResult, staticKey, singleRoot, context, getEffectIndex, context.root === context.effectiveParent || canOmitEndTag(node, context));
|
|
26991
27202
|
if (parentSlots) context.slots = parentSlots;
|
|
26992
27203
|
};
|
|
@@ -26995,11 +27206,35 @@ function canOmitEndTag(node, context) {
|
|
|
26995
27206
|
const { block, parent } = context;
|
|
26996
27207
|
if (!parent) return false;
|
|
26997
27208
|
if (block !== parent.block) return true;
|
|
27209
|
+
if (context.templateCloseTags && (context.templateCloseTags.has(node.tag) || isAlwaysCloseTag(node.tag) || isFormattingTag(node.tag)) || context.templateCloseBlocks && isBlockTag(node.tag)) return false;
|
|
26998
27210
|
if (isAlwaysCloseTag(node.tag) && !context.isOnRightmostPath) return false;
|
|
26999
27211
|
if (isFormattingTag(node.tag) || parent.node.type === 1 && node.tag === parent.node.tag) return context.isOnRightmostPath;
|
|
27000
|
-
if (isBlockTag(node.tag) && context.hasInlineAncestorNeedingClose) return false;
|
|
27001
27212
|
return context.isLastEffectiveChild;
|
|
27002
27213
|
}
|
|
27214
|
+
function getChildTemplateCloseState(context) {
|
|
27215
|
+
const { node } = context;
|
|
27216
|
+
if (node.type !== 1 || node.tagType !== 0 || shouldUseCreateElement(node, context)) return;
|
|
27217
|
+
const inSameTemplateAsParent = isInSameTemplateAsParent(context);
|
|
27218
|
+
const inheritedTags = inSameTemplateAsParent ? context.templateCloseTags : void 0;
|
|
27219
|
+
const inheritedBlocks = inSameTemplateAsParent && context.templateCloseBlocks;
|
|
27220
|
+
if (context.root === context.effectiveParent || canOmitEndTag(node, context) || isVoidTag(node.tag)) return inheritedTags || inheritedBlocks ? {
|
|
27221
|
+
tags: inheritedTags,
|
|
27222
|
+
blocks: inheritedBlocks
|
|
27223
|
+
} : void 0;
|
|
27224
|
+
const tags = new Set(inheritedTags);
|
|
27225
|
+
tags.add(node.tag);
|
|
27226
|
+
return {
|
|
27227
|
+
tags,
|
|
27228
|
+
blocks: inheritedBlocks || isInlineTag(node.tag)
|
|
27229
|
+
};
|
|
27230
|
+
}
|
|
27231
|
+
function isInSameTemplateAsParent(context) {
|
|
27232
|
+
const { parent, node, block } = context;
|
|
27233
|
+
if (!parent || block !== parent.block) return false;
|
|
27234
|
+
const parentNode = parent.node;
|
|
27235
|
+
if (parentNode.type !== 1 || parentNode.tagType !== 0) return false;
|
|
27236
|
+
return !shouldUseCreateElement(parentNode, parent) && isValidHTMLNesting(parentNode.tag, node.tag);
|
|
27237
|
+
}
|
|
27003
27238
|
function isSingleRoot(context) {
|
|
27004
27239
|
if (context.inVFor) return false;
|
|
27005
27240
|
let { parent } = context;
|
|
@@ -27010,11 +27245,11 @@ function isSingleRoot(context) {
|
|
|
27010
27245
|
}
|
|
27011
27246
|
return context.root === parent;
|
|
27012
27247
|
}
|
|
27013
|
-
function transformComponentElement(node, propsResult, staticKey, singleRoot, context, isDynamicComponent,
|
|
27248
|
+
function transformComponentElement(node, propsResult, staticKey, singleRoot, context, isDynamicComponent, useCreateElement) {
|
|
27014
27249
|
const dynamicComponent = isDynamicComponent ? resolveDynamicComponent(node) : void 0;
|
|
27015
27250
|
let { tag } = node;
|
|
27016
27251
|
let asset = true;
|
|
27017
|
-
if (!dynamicComponent && !
|
|
27252
|
+
if (!dynamicComponent && !useCreateElement) {
|
|
27018
27253
|
const fromSetup = resolveSetupReference(tag, context);
|
|
27019
27254
|
if (fromSetup) {
|
|
27020
27255
|
tag = fromSetup;
|
|
@@ -27040,9 +27275,10 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
27040
27275
|
}
|
|
27041
27276
|
context.dynamic.flags |= 6;
|
|
27042
27277
|
const id = context.reference();
|
|
27043
|
-
context.dynamic.operation = {
|
|
27278
|
+
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
27044
27279
|
type: 12,
|
|
27045
|
-
id
|
|
27280
|
+
id
|
|
27281
|
+
}, context.effectBoundary()), {}, {
|
|
27046
27282
|
tag,
|
|
27047
27283
|
props: propsResult[0] ? propsResult[1] : [propsResult[1]],
|
|
27048
27284
|
asset,
|
|
@@ -27050,8 +27286,8 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
27050
27286
|
slots: [...context.slots],
|
|
27051
27287
|
once: context.inVOnce,
|
|
27052
27288
|
dynamic: dynamicComponent,
|
|
27053
|
-
|
|
27054
|
-
};
|
|
27289
|
+
useCreateElement
|
|
27290
|
+
});
|
|
27055
27291
|
if (staticKey) context.registerOperation(createSetBlockKey(id, staticKey));
|
|
27056
27292
|
context.slots = [];
|
|
27057
27293
|
}
|
|
@@ -27112,7 +27348,7 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
27112
27348
|
}
|
|
27113
27349
|
template += `>` + context.childrenTemplate.join("");
|
|
27114
27350
|
if (!isVoidTag(tag) && !omitEndTag) template += `</${tag}>`;
|
|
27115
|
-
|
|
27351
|
+
context.templateRoot = singleRoot;
|
|
27116
27352
|
if (context.parent && context.parent.node.type === 1 && !isValidHTMLNesting(context.parent.node.tag, tag)) {
|
|
27117
27353
|
context.reference();
|
|
27118
27354
|
context.dynamic.template = context.pushTemplate(template);
|
|
@@ -27253,6 +27489,89 @@ function mergePropValues(existing, incoming) {
|
|
|
27253
27489
|
function isComponentTag(tag) {
|
|
27254
27490
|
return tag === "component" || tag === "Component";
|
|
27255
27491
|
}
|
|
27492
|
+
function shouldUseCreateElement(node, context) {
|
|
27493
|
+
return context.options.isCustomElement(node.tag) || node.tagType === 0 && node.tag === "template";
|
|
27494
|
+
}
|
|
27495
|
+
//#endregion
|
|
27496
|
+
//#region packages/compiler-vapor/src/transforms/transformChildren.ts
|
|
27497
|
+
const transformChildren = (node, context) => {
|
|
27498
|
+
const isFragment = node.type === 0 || node.type === 1 && (node.tagType === 3 || node.tagType === 1);
|
|
27499
|
+
if (!isFragment && node.type !== 1) return;
|
|
27500
|
+
const useCreateElement = node.type === 1 && shouldUseCreateElement(node, context);
|
|
27501
|
+
const childTemplateCloseState = !isFragment && !useCreateElement ? getChildTemplateCloseState(context) : void 0;
|
|
27502
|
+
for (const [i, child] of node.children.entries()) {
|
|
27503
|
+
const childContext = context.create(child, i);
|
|
27504
|
+
const isInSameTemplate = childTemplateCloseState && child.type === 1 && child.tagType === 0 && isInSameTemplateAsParent(childContext);
|
|
27505
|
+
childContext.templateCloseTags = isInSameTemplate ? childTemplateCloseState.tags : void 0;
|
|
27506
|
+
childContext.templateCloseBlocks = isInSameTemplate ? childTemplateCloseState.blocks : false;
|
|
27507
|
+
transformNode(childContext);
|
|
27508
|
+
const childDynamic = childContext.dynamic;
|
|
27509
|
+
if (isFragment) {
|
|
27510
|
+
childContext.reference();
|
|
27511
|
+
childContext.registerTemplate();
|
|
27512
|
+
if (!(childDynamic.flags & 2) || childDynamic.flags & 4) context.block.returns.push(childContext.dynamic.id);
|
|
27513
|
+
} else if (useCreateElement) {
|
|
27514
|
+
if (childContext.template !== "" || childDynamic.template != null || childDynamic.id !== void 0 || childDynamic.operation !== void 0 || childDynamic.hasDynamicChild === true) {
|
|
27515
|
+
childContext.reference();
|
|
27516
|
+
childContext.registerTemplate();
|
|
27517
|
+
childDynamic.flags |= 6;
|
|
27518
|
+
}
|
|
27519
|
+
} else context.childrenTemplate.push(childContext.template);
|
|
27520
|
+
if (childDynamic.hasDynamicChild || childDynamic.id !== void 0 || childDynamic.flags & 2 || childDynamic.flags & 4) context.dynamic.hasDynamicChild = true;
|
|
27521
|
+
context.dynamic.children[i] = childDynamic;
|
|
27522
|
+
}
|
|
27523
|
+
if (!isFragment) processDynamicChildren(context);
|
|
27524
|
+
};
|
|
27525
|
+
function processDynamicChildren(context) {
|
|
27526
|
+
let prevDynamics = [];
|
|
27527
|
+
let staticCount = 0;
|
|
27528
|
+
const children = context.dynamic.children;
|
|
27529
|
+
let logicalIndex = 0;
|
|
27530
|
+
for (const [index, child] of children.entries()) {
|
|
27531
|
+
if (child.flags & 4) {
|
|
27532
|
+
child.logicalIndex = logicalIndex;
|
|
27533
|
+
prevDynamics.push(child);
|
|
27534
|
+
logicalIndex++;
|
|
27535
|
+
}
|
|
27536
|
+
if (!(child.flags & 2)) {
|
|
27537
|
+
child.logicalIndex = logicalIndex;
|
|
27538
|
+
if (prevDynamics.length) {
|
|
27539
|
+
if (staticCount) {
|
|
27540
|
+
context.childrenTemplate[index - prevDynamics.length] = `<!>`;
|
|
27541
|
+
prevDynamics[0].flags -= 2;
|
|
27542
|
+
const anchor = prevDynamics[0].anchor = context.increaseId();
|
|
27543
|
+
registerInsertion(prevDynamics, context, anchor);
|
|
27544
|
+
} else registerInsertion(prevDynamics, context, -1);
|
|
27545
|
+
prevDynamics = [];
|
|
27546
|
+
}
|
|
27547
|
+
staticCount++;
|
|
27548
|
+
logicalIndex++;
|
|
27549
|
+
}
|
|
27550
|
+
}
|
|
27551
|
+
if (prevDynamics.length) registerInsertion(prevDynamics, context, prevDynamics[0].logicalIndex, true);
|
|
27552
|
+
}
|
|
27553
|
+
function registerInsertion(dynamics, context, anchor, append) {
|
|
27554
|
+
for (const child of dynamics) {
|
|
27555
|
+
const logicalIndex = child.logicalIndex;
|
|
27556
|
+
if (child.template != null) context.registerOperation({
|
|
27557
|
+
type: 10,
|
|
27558
|
+
elements: dynamics.map((child) => child.id),
|
|
27559
|
+
parent: context.reference(),
|
|
27560
|
+
anchor: append ? void 0 : anchor
|
|
27561
|
+
});
|
|
27562
|
+
else if (child.operation && isBlockOperation(child.operation)) {
|
|
27563
|
+
child.operation.parent = context.reference();
|
|
27564
|
+
child.operation.anchor = anchor;
|
|
27565
|
+
child.operation.logicalIndex = logicalIndex;
|
|
27566
|
+
child.operation.append = append;
|
|
27567
|
+
}
|
|
27568
|
+
}
|
|
27569
|
+
}
|
|
27570
|
+
//#endregion
|
|
27571
|
+
//#region packages/compiler-vapor/src/transforms/vOnce.ts
|
|
27572
|
+
const transformVOnce = (node, context) => {
|
|
27573
|
+
if (node.type === 1 && findDir$1(node, "once", true)) context.inVOnce = true;
|
|
27574
|
+
};
|
|
27256
27575
|
//#endregion
|
|
27257
27576
|
//#region packages/compiler-vapor/src/transforms/vHtml.ts
|
|
27258
27577
|
const transformVHtml = (dir, node, context) => {
|
|
@@ -27273,6 +27592,141 @@ const transformVHtml = (dir, node, context) => {
|
|
|
27273
27592
|
});
|
|
27274
27593
|
};
|
|
27275
27594
|
//#endregion
|
|
27595
|
+
//#region packages/compiler-vapor/src/transforms/transformText.ts
|
|
27596
|
+
const seen = /* @__PURE__ */ new WeakMap();
|
|
27597
|
+
function markNonTemplate(node, context) {
|
|
27598
|
+
let seenNodes = seen.get(context.root);
|
|
27599
|
+
if (!seenNodes) {
|
|
27600
|
+
seenNodes = /* @__PURE__ */ new WeakSet();
|
|
27601
|
+
seen.set(context.root, seenNodes);
|
|
27602
|
+
}
|
|
27603
|
+
seenNodes.add(node);
|
|
27604
|
+
}
|
|
27605
|
+
const transformText = (node, context) => {
|
|
27606
|
+
if (!seen.has(context.root)) seen.set(context.root, /* @__PURE__ */ new WeakSet());
|
|
27607
|
+
if (seen.get(context.root).has(node)) {
|
|
27608
|
+
context.dynamic.flags |= 2;
|
|
27609
|
+
return;
|
|
27610
|
+
}
|
|
27611
|
+
const isFragment = node.type === 0 || node.type === 1 && (node.tagType === 3 || node.tagType === 1);
|
|
27612
|
+
if ((isFragment || node.type === 1 && node.tagType === 0) && node.children.length) {
|
|
27613
|
+
let hasInterp = false;
|
|
27614
|
+
let isAllTextLike = true;
|
|
27615
|
+
for (const c of node.children) if (c.type === 5) hasInterp = true;
|
|
27616
|
+
else if (c.type !== 2) isAllTextLike = false;
|
|
27617
|
+
if (!isFragment && isAllTextLike && hasInterp) {
|
|
27618
|
+
const elementContext = context;
|
|
27619
|
+
if (shouldUseCreateElement(node, elementContext)) processCreateElementTextContainer(node.children, elementContext);
|
|
27620
|
+
else processTextContainer(node.children, elementContext);
|
|
27621
|
+
} else if (hasInterp) for (let i = 0; i < node.children.length; i++) {
|
|
27622
|
+
const c = node.children[i];
|
|
27623
|
+
const prev = node.children[i - 1];
|
|
27624
|
+
if (c.type === 5 && prev && prev.type === 2) markNonTemplate(prev, context);
|
|
27625
|
+
}
|
|
27626
|
+
} else if (node.type === 5) processInterpolation(context);
|
|
27627
|
+
else if (node.type === 2) {
|
|
27628
|
+
var _context$parent;
|
|
27629
|
+
const parent = (_context$parent = context.parent) === null || _context$parent === void 0 ? void 0 : _context$parent.node;
|
|
27630
|
+
if (parent && parent.type === 1 && shouldUseCreateElement(parent, context.parent) && node.content[0] === "<") {
|
|
27631
|
+
materializeLiteralTextNode(createSimpleExpression(node.content, true, node.loc), context);
|
|
27632
|
+
return;
|
|
27633
|
+
}
|
|
27634
|
+
const isRootText = !parent || parent.type === 0 || parent.type === 1 && (parent.tagType === 3 || parent.tagType === 1);
|
|
27635
|
+
context.template += isRootText ? node.content : escapeHtml(node.content);
|
|
27636
|
+
}
|
|
27637
|
+
};
|
|
27638
|
+
function processInterpolation(context) {
|
|
27639
|
+
const parentNode = context.parent.node;
|
|
27640
|
+
const children = parentNode.children;
|
|
27641
|
+
const nexts = children.slice(context.index);
|
|
27642
|
+
const idx = nexts.findIndex((n) => !isTextLike(n));
|
|
27643
|
+
const nodes = idx > -1 ? nexts.slice(0, idx) : nexts;
|
|
27644
|
+
const prev = children[context.index - 1];
|
|
27645
|
+
if (prev && prev.type === 2) nodes.unshift(prev);
|
|
27646
|
+
const values = processTextLikeChildren(nodes, context);
|
|
27647
|
+
if (values.length === 0 && parentNode.type !== 0) return;
|
|
27648
|
+
const literalValues = values.map((v) => getLiteralExpressionValue(v));
|
|
27649
|
+
if (literalValues.every((v) => v != null) && parentNode.type !== 0) {
|
|
27650
|
+
const text = literalValues.join("");
|
|
27651
|
+
if (parentNode.type === 1 && shouldUseCreateElement(parentNode, context.parent) && text[0] === "<") {
|
|
27652
|
+
materializeLiteralTextNode(createSimpleExpression(text, true, context.node.loc), context);
|
|
27653
|
+
return;
|
|
27654
|
+
}
|
|
27655
|
+
const isElementChild = parentNode.type === 1 && parentNode.tagType === 0;
|
|
27656
|
+
context.template += isElementChild ? escapeHtml(text) : text;
|
|
27657
|
+
return;
|
|
27658
|
+
}
|
|
27659
|
+
context.template += " ";
|
|
27660
|
+
const id = context.reference();
|
|
27661
|
+
if (values.length === 0) return;
|
|
27662
|
+
context.registerEffect(values, {
|
|
27663
|
+
type: 5,
|
|
27664
|
+
element: id,
|
|
27665
|
+
values
|
|
27666
|
+
});
|
|
27667
|
+
}
|
|
27668
|
+
function processTextContainer(children, context) {
|
|
27669
|
+
const values = processTextLikeChildren(children, context);
|
|
27670
|
+
const literals = values.map((value) => getLiteralExpressionValue(value));
|
|
27671
|
+
if (literals.every((l) => l != null)) context.childrenTemplate = literals.map((l) => escapeHtml(String(l)));
|
|
27672
|
+
else {
|
|
27673
|
+
context.childrenTemplate = [" "];
|
|
27674
|
+
context.registerOperation({
|
|
27675
|
+
type: 18,
|
|
27676
|
+
parent: context.reference()
|
|
27677
|
+
});
|
|
27678
|
+
context.registerEffect(values, {
|
|
27679
|
+
type: 5,
|
|
27680
|
+
element: context.reference(),
|
|
27681
|
+
values,
|
|
27682
|
+
generated: true
|
|
27683
|
+
});
|
|
27684
|
+
}
|
|
27685
|
+
}
|
|
27686
|
+
function registerSyntheticTextChild(context, template, values) {
|
|
27687
|
+
const id = context.increaseId();
|
|
27688
|
+
context.dynamic.children[context.node.children.length] = {
|
|
27689
|
+
id,
|
|
27690
|
+
flags: 6,
|
|
27691
|
+
children: [],
|
|
27692
|
+
template: context.pushTemplate(template)
|
|
27693
|
+
};
|
|
27694
|
+
context.dynamic.hasDynamicChild = true;
|
|
27695
|
+
if (values && values.length) context.registerEffect(values, {
|
|
27696
|
+
type: 5,
|
|
27697
|
+
element: id,
|
|
27698
|
+
values
|
|
27699
|
+
});
|
|
27700
|
+
return id;
|
|
27701
|
+
}
|
|
27702
|
+
function processCreateElementTextContainer(children, context) {
|
|
27703
|
+
registerSyntheticTextChild(context, "", processTextLikeChildren(children, context));
|
|
27704
|
+
}
|
|
27705
|
+
function materializeLiteralTextNode(value, context) {
|
|
27706
|
+
const id = context.reference();
|
|
27707
|
+
context.dynamic.flags |= 6;
|
|
27708
|
+
context.dynamic.template = context.pushTemplate("");
|
|
27709
|
+
context.registerEffect([value], {
|
|
27710
|
+
type: 5,
|
|
27711
|
+
element: id,
|
|
27712
|
+
values: [value]
|
|
27713
|
+
});
|
|
27714
|
+
}
|
|
27715
|
+
function processTextLikeChildren(nodes, context) {
|
|
27716
|
+
const exps = [];
|
|
27717
|
+
for (const node of nodes) {
|
|
27718
|
+
let exp;
|
|
27719
|
+
markNonTemplate(node, context);
|
|
27720
|
+
if (node.type === 2) exp = createSimpleExpression(node.content, true, node.loc);
|
|
27721
|
+
else exp = node.content;
|
|
27722
|
+
if (exp.content) exps.push(exp);
|
|
27723
|
+
}
|
|
27724
|
+
return exps;
|
|
27725
|
+
}
|
|
27726
|
+
function isTextLike(node) {
|
|
27727
|
+
return node.type === 5 || node.type === 2;
|
|
27728
|
+
}
|
|
27729
|
+
//#endregion
|
|
27276
27730
|
//#region packages/compiler-vapor/src/transforms/vText.ts
|
|
27277
27731
|
const transformVText = (dir, node, context) => {
|
|
27278
27732
|
let { exp, loc } = dir;
|
|
@@ -27283,22 +27737,41 @@ const transformVText = (dir, node, context) => {
|
|
|
27283
27737
|
if (node.children.length) {
|
|
27284
27738
|
context.options.onError(createDOMCompilerError(57, loc));
|
|
27285
27739
|
context.childrenTemplate.length = 0;
|
|
27740
|
+
for (const child of node.children) markNonTemplate(child, context);
|
|
27286
27741
|
}
|
|
27287
27742
|
if (isVoidTag(context.node.tag)) return;
|
|
27288
27743
|
const literal = getLiteralExpressionValue(exp);
|
|
27289
|
-
|
|
27290
|
-
|
|
27291
|
-
|
|
27292
|
-
|
|
27293
|
-
|
|
27294
|
-
|
|
27744
|
+
const useCreateElement = shouldUseCreateElement(context.node, context);
|
|
27745
|
+
if (literal != null) if (useCreateElement) {
|
|
27746
|
+
const id = registerSyntheticTextChild(context, "", [exp]);
|
|
27747
|
+
context.registerOperation({
|
|
27748
|
+
type: 10,
|
|
27749
|
+
elements: [id],
|
|
27295
27750
|
parent: context.reference()
|
|
27296
27751
|
});
|
|
27752
|
+
} else context.childrenTemplate = [String(literal)];
|
|
27753
|
+
else {
|
|
27754
|
+
const isComponent = node.tagType === 1;
|
|
27755
|
+
let id;
|
|
27756
|
+
if (useCreateElement) {
|
|
27757
|
+
id = registerSyntheticTextChild(context, "");
|
|
27758
|
+
context.registerOperation({
|
|
27759
|
+
type: 10,
|
|
27760
|
+
elements: [id],
|
|
27761
|
+
parent: context.reference()
|
|
27762
|
+
});
|
|
27763
|
+
} else if (!isComponent) {
|
|
27764
|
+
context.childrenTemplate = [" "];
|
|
27765
|
+
context.registerOperation({
|
|
27766
|
+
type: 18,
|
|
27767
|
+
parent: context.reference()
|
|
27768
|
+
});
|
|
27769
|
+
}
|
|
27297
27770
|
context.registerEffect([exp], {
|
|
27298
27771
|
type: 5,
|
|
27299
|
-
element: context.reference(),
|
|
27772
|
+
element: useCreateElement ? id : context.reference(),
|
|
27300
27773
|
values: [exp],
|
|
27301
|
-
generated:
|
|
27774
|
+
generated: !useCreateElement,
|
|
27302
27775
|
isComponent
|
|
27303
27776
|
});
|
|
27304
27777
|
}
|
|
@@ -27312,6 +27785,7 @@ const transformVOn = (dir, node, context) => {
|
|
|
27312
27785
|
const isSlotOutlet = node.tag === "slot";
|
|
27313
27786
|
if (!exp && !modifiers.length) context.options.onError(createCompilerError(35, loc));
|
|
27314
27787
|
arg = resolveExpression(arg);
|
|
27788
|
+
if (arg.isStatic && arg.content.startsWith("vue:")) arg = extend({}, arg, { content: `vnode-${arg.content.slice(4)}` });
|
|
27315
27789
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(arg.isStatic ? `on${arg.content}` : arg, modifiers, null, loc);
|
|
27316
27790
|
let keyOverride;
|
|
27317
27791
|
const isStaticClick = arg.isStatic && arg.content.toLowerCase() === "click";
|
|
@@ -27411,96 +27885,6 @@ const transformTemplateRef = (node, context) => {
|
|
|
27411
27885
|
};
|
|
27412
27886
|
};
|
|
27413
27887
|
//#endregion
|
|
27414
|
-
//#region packages/compiler-vapor/src/transforms/transformText.ts
|
|
27415
|
-
const seen = /* @__PURE__ */ new WeakMap();
|
|
27416
|
-
function markNonTemplate(node, context) {
|
|
27417
|
-
seen.get(context.root).add(node);
|
|
27418
|
-
}
|
|
27419
|
-
const transformText = (node, context) => {
|
|
27420
|
-
if (!seen.has(context.root)) seen.set(context.root, /* @__PURE__ */ new WeakSet());
|
|
27421
|
-
if (seen.get(context.root).has(node)) {
|
|
27422
|
-
context.dynamic.flags |= 2;
|
|
27423
|
-
return;
|
|
27424
|
-
}
|
|
27425
|
-
const isFragment = node.type === 0 || node.type === 1 && (node.tagType === 3 || node.tagType === 1);
|
|
27426
|
-
if ((isFragment || node.type === 1 && node.tagType === 0) && node.children.length) {
|
|
27427
|
-
let hasInterp = false;
|
|
27428
|
-
let isAllTextLike = true;
|
|
27429
|
-
for (const c of node.children) if (c.type === 5) hasInterp = true;
|
|
27430
|
-
else if (c.type !== 2) isAllTextLike = false;
|
|
27431
|
-
if (!isFragment && isAllTextLike && hasInterp) processTextContainer(node.children, context);
|
|
27432
|
-
else if (hasInterp) for (let i = 0; i < node.children.length; i++) {
|
|
27433
|
-
const c = node.children[i];
|
|
27434
|
-
const prev = node.children[i - 1];
|
|
27435
|
-
if (c.type === 5 && prev && prev.type === 2) markNonTemplate(prev, context);
|
|
27436
|
-
}
|
|
27437
|
-
} else if (node.type === 5) processInterpolation(context);
|
|
27438
|
-
else if (node.type === 2) {
|
|
27439
|
-
var _context$parent;
|
|
27440
|
-
const parent = (_context$parent = context.parent) === null || _context$parent === void 0 ? void 0 : _context$parent.node;
|
|
27441
|
-
const isRootText = !parent || parent.type === 0 || parent.type === 1 && (parent.tagType === 3 || parent.tagType === 1);
|
|
27442
|
-
context.template += isRootText ? node.content : escapeHtml(node.content);
|
|
27443
|
-
}
|
|
27444
|
-
};
|
|
27445
|
-
function processInterpolation(context) {
|
|
27446
|
-
const parentNode = context.parent.node;
|
|
27447
|
-
const children = parentNode.children;
|
|
27448
|
-
const nexts = children.slice(context.index);
|
|
27449
|
-
const idx = nexts.findIndex((n) => !isTextLike(n));
|
|
27450
|
-
const nodes = idx > -1 ? nexts.slice(0, idx) : nexts;
|
|
27451
|
-
const prev = children[context.index - 1];
|
|
27452
|
-
if (prev && prev.type === 2) nodes.unshift(prev);
|
|
27453
|
-
const values = processTextLikeChildren(nodes, context);
|
|
27454
|
-
if (values.length === 0 && parentNode.type !== 0) return;
|
|
27455
|
-
const literalValues = values.map((v) => getLiteralExpressionValue(v));
|
|
27456
|
-
if (literalValues.every((v) => v != null) && parentNode.type !== 0) {
|
|
27457
|
-
const text = literalValues.join("");
|
|
27458
|
-
const isElementChild = parentNode.type === 1 && parentNode.tagType === 0;
|
|
27459
|
-
context.template += isElementChild ? escapeHtml(text) : text;
|
|
27460
|
-
return;
|
|
27461
|
-
}
|
|
27462
|
-
context.template += " ";
|
|
27463
|
-
const id = context.reference();
|
|
27464
|
-
if (values.length === 0) return;
|
|
27465
|
-
context.registerEffect(values, {
|
|
27466
|
-
type: 5,
|
|
27467
|
-
element: id,
|
|
27468
|
-
values
|
|
27469
|
-
});
|
|
27470
|
-
}
|
|
27471
|
-
function processTextContainer(children, context) {
|
|
27472
|
-
const values = processTextLikeChildren(children, context);
|
|
27473
|
-
const literals = values.map((value) => getLiteralExpressionValue(value));
|
|
27474
|
-
if (literals.every((l) => l != null)) context.childrenTemplate = literals.map((l) => escapeHtml(String(l)));
|
|
27475
|
-
else {
|
|
27476
|
-
context.childrenTemplate = [" "];
|
|
27477
|
-
context.registerOperation({
|
|
27478
|
-
type: 18,
|
|
27479
|
-
parent: context.reference()
|
|
27480
|
-
});
|
|
27481
|
-
context.registerEffect(values, {
|
|
27482
|
-
type: 5,
|
|
27483
|
-
element: context.reference(),
|
|
27484
|
-
values,
|
|
27485
|
-
generated: true
|
|
27486
|
-
});
|
|
27487
|
-
}
|
|
27488
|
-
}
|
|
27489
|
-
function processTextLikeChildren(nodes, context) {
|
|
27490
|
-
const exps = [];
|
|
27491
|
-
for (const node of nodes) {
|
|
27492
|
-
let exp;
|
|
27493
|
-
markNonTemplate(node, context);
|
|
27494
|
-
if (node.type === 2) exp = createSimpleExpression(node.content, true, node.loc);
|
|
27495
|
-
else exp = node.content;
|
|
27496
|
-
if (exp.content) exps.push(exp);
|
|
27497
|
-
}
|
|
27498
|
-
return exps;
|
|
27499
|
-
}
|
|
27500
|
-
function isTextLike(node) {
|
|
27501
|
-
return node.type === 5 || node.type === 2;
|
|
27502
|
-
}
|
|
27503
|
-
//#endregion
|
|
27504
27888
|
//#region packages/compiler-vapor/src/transforms/vModel.ts
|
|
27505
27889
|
const transformVModel = (dir, node, context) => {
|
|
27506
27890
|
const { exp, arg } = dir;
|
|
@@ -27598,6 +27982,7 @@ function getSiblingIf(context, reverse) {
|
|
|
27598
27982
|
}
|
|
27599
27983
|
//#endregion
|
|
27600
27984
|
//#region packages/compiler-vapor/src/transforms/vIf.ts
|
|
27985
|
+
init_objectSpread2();
|
|
27601
27986
|
const transformVIf = createStructuralDirectiveTransform([
|
|
27602
27987
|
"if",
|
|
27603
27988
|
"else",
|
|
@@ -27617,15 +28002,16 @@ function processIf(node, dir, context) {
|
|
|
27617
28002
|
const [branch, onExit] = createIfBranch(node, context);
|
|
27618
28003
|
return () => {
|
|
27619
28004
|
onExit();
|
|
27620
|
-
context.dynamic.operation = {
|
|
28005
|
+
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
27621
28006
|
type: 15,
|
|
27622
|
-
id
|
|
28007
|
+
id
|
|
28008
|
+
}, context.effectBoundary()), {}, {
|
|
27623
28009
|
blockShape: encodeIfBlockShape(branch, forceMultiRoot),
|
|
27624
28010
|
condition: dir.exp,
|
|
27625
28011
|
positive: branch,
|
|
27626
28012
|
index: context.root.nextIfIndex(),
|
|
27627
28013
|
once: context.inVOnce || isStaticExpression(dir.exp, context.options.bindingMetadata)
|
|
27628
|
-
};
|
|
28014
|
+
});
|
|
27629
28015
|
};
|
|
27630
28016
|
} else {
|
|
27631
28017
|
const siblingIf = getSiblingIf(context, true);
|
|
@@ -27692,6 +28078,7 @@ function shouldForceMultiRoot(context) {
|
|
|
27692
28078
|
}
|
|
27693
28079
|
//#endregion
|
|
27694
28080
|
//#region packages/compiler-vapor/src/transforms/vFor.ts
|
|
28081
|
+
init_objectSpread2();
|
|
27695
28082
|
const transformVFor = createStructuralDirectiveTransform("for", processFor);
|
|
27696
28083
|
function processFor(node, dir, context) {
|
|
27697
28084
|
if (!dir.exp) {
|
|
@@ -27717,9 +28104,10 @@ function processFor(node, dir, context) {
|
|
|
27717
28104
|
exitBlock();
|
|
27718
28105
|
const { parent } = context;
|
|
27719
28106
|
const isOnlyChild = parent && parent.block.node !== parent.node && parent.node.children.length === 1;
|
|
27720
|
-
context.dynamic.operation = {
|
|
28107
|
+
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
27721
28108
|
type: 16,
|
|
27722
|
-
id
|
|
28109
|
+
id
|
|
28110
|
+
}, context.effectBoundary()), {}, {
|
|
27723
28111
|
source,
|
|
27724
28112
|
value,
|
|
27725
28113
|
key,
|
|
@@ -27729,7 +28117,7 @@ function processFor(node, dir, context) {
|
|
|
27729
28117
|
once: context.inVOnce || isStaticExpression(source, context.options.bindingMetadata),
|
|
27730
28118
|
component: isComponent,
|
|
27731
28119
|
onlyChild: !!isOnlyChild
|
|
27732
|
-
};
|
|
28120
|
+
});
|
|
27733
28121
|
};
|
|
27734
28122
|
}
|
|
27735
28123
|
function isTemplateWithSingleComponent(node) {
|
|
@@ -27739,6 +28127,7 @@ function isTemplateWithSingleComponent(node) {
|
|
|
27739
28127
|
}
|
|
27740
28128
|
//#endregion
|
|
27741
28129
|
//#region packages/compiler-vapor/src/transforms/transformSlotOutlet.ts
|
|
28130
|
+
init_objectSpread2();
|
|
27742
28131
|
const transformSlotOutlet = (node, context) => {
|
|
27743
28132
|
if (node.type !== 1 || node.tag !== "slot") return;
|
|
27744
28133
|
const id = context.reference();
|
|
@@ -27769,15 +28158,16 @@ const transformSlotOutlet = (node, context) => {
|
|
|
27769
28158
|
}
|
|
27770
28159
|
return () => {
|
|
27771
28160
|
exitBlock && exitBlock();
|
|
27772
|
-
context.dynamic.operation = {
|
|
28161
|
+
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
27773
28162
|
type: 13,
|
|
27774
|
-
id
|
|
28163
|
+
id
|
|
28164
|
+
}, context.effectBoundary()), {}, {
|
|
27775
28165
|
name: slotName,
|
|
27776
28166
|
props: irProps,
|
|
27777
28167
|
fallback,
|
|
27778
28168
|
noSlotted: !!(context.options.scopeId && !context.options.slotted),
|
|
27779
28169
|
once: context.inVOnce
|
|
27780
|
-
};
|
|
28170
|
+
});
|
|
27781
28171
|
};
|
|
27782
28172
|
};
|
|
27783
28173
|
function createFallback(node, context) {
|
|
@@ -27954,6 +28344,7 @@ function hasMultipleChildren(node) {
|
|
|
27954
28344
|
}
|
|
27955
28345
|
//#endregion
|
|
27956
28346
|
//#region packages/compiler-vapor/src/transforms/transformKey.ts
|
|
28347
|
+
init_objectSpread2();
|
|
27957
28348
|
const transformKey = (node, context) => {
|
|
27958
28349
|
if (node.type !== 1 || context.inVOnce || findDir(node, "for")) return;
|
|
27959
28350
|
const dir = findProp(node, "key", true, true);
|
|
@@ -27968,12 +28359,13 @@ const transformKey = (node, context) => {
|
|
|
27968
28359
|
const exitBlock = context.enterBlock(block);
|
|
27969
28360
|
return () => {
|
|
27970
28361
|
exitBlock();
|
|
27971
|
-
context.dynamic.operation = {
|
|
28362
|
+
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
27972
28363
|
type: 17,
|
|
27973
|
-
id
|
|
28364
|
+
id
|
|
28365
|
+
}, context.effectBoundary()), {}, {
|
|
27974
28366
|
value,
|
|
27975
28367
|
block
|
|
27976
|
-
};
|
|
28368
|
+
});
|
|
27977
28369
|
};
|
|
27978
28370
|
};
|
|
27979
28371
|
//#endregion
|
|
@@ -28040,6 +28432,7 @@ var src_exports$1 = /* @__PURE__ */ __exportAll({
|
|
|
28040
28432
|
IRDynamicPropsKind: () => IRDynamicPropsKind,
|
|
28041
28433
|
IRNodeTypes: () => IRNodeTypes,
|
|
28042
28434
|
IRSlotType: () => IRSlotType,
|
|
28435
|
+
TemplateRegistry: () => TemplateRegistry,
|
|
28043
28436
|
VaporErrorCodes: () => VaporErrorCodes,
|
|
28044
28437
|
VaporErrorMessages: () => VaporErrorMessages,
|
|
28045
28438
|
buildCodeFragment: () => buildCodeFragment,
|
|
@@ -28605,6 +28998,8 @@ function subTransform(node, options, parentContext) {
|
|
|
28605
28998
|
childContext.ssr = false;
|
|
28606
28999
|
childContext.scopes = _objectSpread2({}, parentContext.scopes);
|
|
28607
29000
|
childContext.identifiers = _objectSpread2({}, parentContext.identifiers);
|
|
29001
|
+
childContext.identifierScopes = Object.create(null);
|
|
29002
|
+
for (const name in parentContext.identifierScopes) childContext.identifierScopes[name] = parentContext.identifierScopes[name].slice();
|
|
28608
29003
|
childContext.imports = parentContext.imports;
|
|
28609
29004
|
traverseNode(childRoot, childContext);
|
|
28610
29005
|
[
|
|
@@ -28999,6 +29394,7 @@ function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ast:
|
|
|
28999
29394
|
slotted,
|
|
29000
29395
|
sourceMap: true
|
|
29001
29396
|
}, compilerOptions), {}, {
|
|
29397
|
+
bindingMetadata: vapor && !ssr && compilerOptions.bindingMetadata == null ? {} : compilerOptions.bindingMetadata,
|
|
29002
29398
|
hmr: !isProd,
|
|
29003
29399
|
nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []),
|
|
29004
29400
|
filename,
|
|
@@ -29131,10 +29527,10 @@ var require_picocolors_browser = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
29131
29527
|
module.exports.createColors = create;
|
|
29132
29528
|
}));
|
|
29133
29529
|
//#endregion
|
|
29134
|
-
//#region (ignored) node_modules/.pnpm/postcss@8.5.
|
|
29530
|
+
//#region (ignored) node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/terminal-highlight
|
|
29135
29531
|
var require_terminal_highlight = /* @__PURE__ */ __commonJSMin((() => {}));
|
|
29136
29532
|
//#endregion
|
|
29137
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
29533
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/css-syntax-error.js
|
|
29138
29534
|
var require_css_syntax_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
29139
29535
|
let pico = require_picocolors_browser();
|
|
29140
29536
|
let terminalHighlight = require_terminal_highlight();
|
|
@@ -29209,8 +29605,15 @@ var require_css_syntax_error = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
29209
29605
|
CssSyntaxError.default = CssSyntaxError;
|
|
29210
29606
|
}));
|
|
29211
29607
|
//#endregion
|
|
29212
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
29608
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/stringifier.js
|
|
29213
29609
|
var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
29610
|
+
const STYLE_TAG = /(<)(\/?style\b)/gi;
|
|
29611
|
+
const COMMENT_OPEN = /(<)(!--)/g;
|
|
29612
|
+
function escapeHTMLInCSS(str) {
|
|
29613
|
+
if (typeof str !== "string") return str;
|
|
29614
|
+
if (!str.includes("<")) return str;
|
|
29615
|
+
return str.replace(STYLE_TAG, "\\3c $2").replace(COMMENT_OPEN, "\\3c $2");
|
|
29616
|
+
}
|
|
29214
29617
|
const DEFAULT_RAW = {
|
|
29215
29618
|
after: "\n",
|
|
29216
29619
|
beforeClose: "\n",
|
|
@@ -29233,14 +29636,15 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29233
29636
|
this.builder = builder;
|
|
29234
29637
|
}
|
|
29235
29638
|
atrule(node, semicolon) {
|
|
29639
|
+
let raws = node.raws;
|
|
29236
29640
|
let name = "@" + node.name;
|
|
29237
29641
|
let params = node.params ? this.rawValue(node, "params") : "";
|
|
29238
|
-
if (typeof
|
|
29642
|
+
if (typeof raws.afterName !== "undefined") name += raws.afterName;
|
|
29239
29643
|
else if (params) name += " ";
|
|
29240
29644
|
if (node.nodes) this.block(node, name + params);
|
|
29241
29645
|
else {
|
|
29242
|
-
let end = (
|
|
29243
|
-
this.builder(name + params + end, node);
|
|
29646
|
+
let end = (raws.between || "") + (semicolon ? ";" : "");
|
|
29647
|
+
this.builder(escapeHTMLInCSS(name + params + end), node);
|
|
29244
29648
|
}
|
|
29245
29649
|
}
|
|
29246
29650
|
beforeAfter(node, detect) {
|
|
@@ -29263,40 +29667,43 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29263
29667
|
}
|
|
29264
29668
|
block(node, start) {
|
|
29265
29669
|
let between = this.raw(node, "between", "beforeOpen");
|
|
29266
|
-
this.builder(start + between + "{", node, "start");
|
|
29670
|
+
this.builder(escapeHTMLInCSS(start + between) + "{", node, "start");
|
|
29267
29671
|
let after;
|
|
29268
29672
|
if (node.nodes && node.nodes.length) {
|
|
29269
29673
|
this.body(node);
|
|
29270
29674
|
after = this.raw(node, "after");
|
|
29271
29675
|
} else after = this.raw(node, "after", "emptyBody");
|
|
29272
|
-
if (after) this.builder(after);
|
|
29676
|
+
if (after) this.builder(escapeHTMLInCSS(after));
|
|
29273
29677
|
this.builder("}", node, "end");
|
|
29274
29678
|
}
|
|
29275
29679
|
body(node) {
|
|
29276
|
-
let
|
|
29680
|
+
let nodes = node.nodes;
|
|
29681
|
+
let last = nodes.length - 1;
|
|
29277
29682
|
while (last > 0) {
|
|
29278
|
-
if (
|
|
29683
|
+
if (nodes[last].type !== "comment") break;
|
|
29279
29684
|
last -= 1;
|
|
29280
29685
|
}
|
|
29281
29686
|
let semicolon = this.raw(node, "semicolon");
|
|
29282
|
-
|
|
29283
|
-
|
|
29687
|
+
let isDocument = node.type === "document";
|
|
29688
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
29689
|
+
let child = nodes[i];
|
|
29284
29690
|
let before = this.raw(child, "before");
|
|
29285
|
-
if (before) this.builder(before);
|
|
29691
|
+
if (before) this.builder(isDocument ? before : escapeHTMLInCSS(before));
|
|
29286
29692
|
this.stringify(child, last !== i || semicolon);
|
|
29287
29693
|
}
|
|
29288
29694
|
}
|
|
29289
29695
|
comment(node) {
|
|
29290
29696
|
let left = this.raw(node, "left", "commentLeft");
|
|
29291
29697
|
let right = this.raw(node, "right", "commentRight");
|
|
29292
|
-
this.builder("/*" + left + node.text + right + "*/", node);
|
|
29698
|
+
this.builder(escapeHTMLInCSS("/*" + left + node.text + right + "*/"), node);
|
|
29293
29699
|
}
|
|
29294
29700
|
decl(node, semicolon) {
|
|
29701
|
+
let raws = node.raws;
|
|
29295
29702
|
let between = this.raw(node, "between", "colon");
|
|
29296
29703
|
let string = node.prop + between + this.rawValue(node, "value");
|
|
29297
|
-
if (node.important) string +=
|
|
29704
|
+
if (node.important) string += raws.important || " !important";
|
|
29298
29705
|
if (semicolon) string += ";";
|
|
29299
|
-
this.builder(string, node);
|
|
29706
|
+
this.builder(escapeHTMLInCSS(string), node);
|
|
29300
29707
|
}
|
|
29301
29708
|
document(node) {
|
|
29302
29709
|
this.body(node);
|
|
@@ -29315,8 +29722,8 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29315
29722
|
}
|
|
29316
29723
|
if (!parent) return DEFAULT_RAW[detect];
|
|
29317
29724
|
let root = node.root();
|
|
29318
|
-
|
|
29319
|
-
if (typeof
|
|
29725
|
+
let cache = root.rawCache || (root.rawCache = {});
|
|
29726
|
+
if (typeof cache[detect] !== "undefined") return cache[detect];
|
|
29320
29727
|
if (detect === "before" || detect === "after") return this.beforeAfter(node, detect);
|
|
29321
29728
|
else {
|
|
29322
29729
|
let method = "raw" + capitalize(detect);
|
|
@@ -29327,7 +29734,7 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29327
29734
|
});
|
|
29328
29735
|
}
|
|
29329
29736
|
if (typeof value === "undefined") value = DEFAULT_RAW[detect];
|
|
29330
|
-
|
|
29737
|
+
cache[detect] = value;
|
|
29331
29738
|
return value;
|
|
29332
29739
|
}
|
|
29333
29740
|
rawBeforeClose(root) {
|
|
@@ -29448,11 +29855,15 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29448
29855
|
}
|
|
29449
29856
|
root(node) {
|
|
29450
29857
|
this.body(node);
|
|
29451
|
-
if (node.raws.after)
|
|
29858
|
+
if (node.raws.after) {
|
|
29859
|
+
let after = node.raws.after;
|
|
29860
|
+
let isDocument = node.parent && node.parent.type === "document";
|
|
29861
|
+
this.builder(isDocument ? after : escapeHTMLInCSS(after));
|
|
29862
|
+
}
|
|
29452
29863
|
}
|
|
29453
29864
|
rule(node) {
|
|
29454
29865
|
this.block(node, this.rawValue(node, "selector"));
|
|
29455
|
-
if (node.raws.ownSemicolon) this.builder(node.raws.ownSemicolon, node, "end");
|
|
29866
|
+
if (node.raws.ownSemicolon) this.builder(escapeHTMLInCSS(node.raws.ownSemicolon), node, "end");
|
|
29456
29867
|
}
|
|
29457
29868
|
stringify(node, semicolon) {
|
|
29458
29869
|
/* c8 ignore start */
|
|
@@ -29465,7 +29876,7 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29465
29876
|
Stringifier.default = Stringifier;
|
|
29466
29877
|
}));
|
|
29467
29878
|
//#endregion
|
|
29468
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
29879
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/stringify.js
|
|
29469
29880
|
var require_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
29470
29881
|
let Stringifier = require_stringifier();
|
|
29471
29882
|
function stringify(node, builder) {
|
|
@@ -29475,13 +29886,13 @@ var require_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29475
29886
|
stringify.default = stringify;
|
|
29476
29887
|
}));
|
|
29477
29888
|
//#endregion
|
|
29478
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
29889
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/symbols.js
|
|
29479
29890
|
var require_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
29480
29891
|
module.exports.isClean = Symbol("isClean");
|
|
29481
29892
|
module.exports.my = Symbol("my");
|
|
29482
29893
|
}));
|
|
29483
29894
|
//#endregion
|
|
29484
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
29895
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/node.js
|
|
29485
29896
|
var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
29486
29897
|
let CssSyntaxError = require_css_syntax_error();
|
|
29487
29898
|
let Stringifier = require_stringifier();
|
|
@@ -29782,7 +30193,7 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29782
30193
|
Node.default = Node;
|
|
29783
30194
|
}));
|
|
29784
30195
|
//#endregion
|
|
29785
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
30196
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/comment.js
|
|
29786
30197
|
var require_comment$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
29787
30198
|
let Node = require_node$1();
|
|
29788
30199
|
var Comment = class extends Node {
|
|
@@ -29795,7 +30206,7 @@ var require_comment$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29795
30206
|
Comment.default = Comment;
|
|
29796
30207
|
}));
|
|
29797
30208
|
//#endregion
|
|
29798
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
30209
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/declaration.js
|
|
29799
30210
|
var require_declaration = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
29800
30211
|
init_objectSpread2();
|
|
29801
30212
|
let Node = require_node$1();
|
|
@@ -29813,7 +30224,7 @@ var require_declaration = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29813
30224
|
Declaration.default = Declaration;
|
|
29814
30225
|
}));
|
|
29815
30226
|
//#endregion
|
|
29816
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
30227
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/container.js
|
|
29817
30228
|
var require_container$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
29818
30229
|
let Comment = require_comment$1();
|
|
29819
30230
|
let Declaration = require_declaration();
|
|
@@ -30105,7 +30516,7 @@ var require_container$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30105
30516
|
}));
|
|
30106
30517
|
/* c8 ignore stop */
|
|
30107
30518
|
//#endregion
|
|
30108
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
30519
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/at-rule.js
|
|
30109
30520
|
var require_at_rule = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30110
30521
|
let Container = require_container$1();
|
|
30111
30522
|
var AtRule = class extends Container {
|
|
@@ -30127,7 +30538,7 @@ var require_at_rule = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30127
30538
|
Container.registerAtRule(AtRule);
|
|
30128
30539
|
}));
|
|
30129
30540
|
//#endregion
|
|
30130
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
30541
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/document.js
|
|
30131
30542
|
var require_document = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30132
30543
|
init_objectSpread2();
|
|
30133
30544
|
let Container = require_container$1();
|
|
@@ -30151,7 +30562,7 @@ var require_document = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30151
30562
|
Document.default = Document;
|
|
30152
30563
|
}));
|
|
30153
30564
|
//#endregion
|
|
30154
|
-
//#region \0@oxc-project+runtime@0.
|
|
30565
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/objectWithoutPropertiesLoose.js
|
|
30155
30566
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
30156
30567
|
if (null == r) return {};
|
|
30157
30568
|
var t = {};
|
|
@@ -30163,7 +30574,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
30163
30574
|
}
|
|
30164
30575
|
var init_objectWithoutPropertiesLoose = __esmMin((() => {}));
|
|
30165
30576
|
//#endregion
|
|
30166
|
-
//#region \0@oxc-project+runtime@0.
|
|
30577
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/objectWithoutProperties.js
|
|
30167
30578
|
function _objectWithoutProperties(e, t) {
|
|
30168
30579
|
if (null == e) return {};
|
|
30169
30580
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
@@ -30177,7 +30588,7 @@ var init_objectWithoutProperties = __esmMin((() => {
|
|
|
30177
30588
|
init_objectWithoutPropertiesLoose();
|
|
30178
30589
|
}));
|
|
30179
30590
|
//#endregion
|
|
30180
|
-
//#region node_modules/.pnpm/nanoid@3.3.
|
|
30591
|
+
//#region node_modules/.pnpm/nanoid@3.3.12/node_modules/nanoid/non-secure/index.cjs
|
|
30181
30592
|
var require_non_secure = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30182
30593
|
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
30183
30594
|
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
@@ -30200,10 +30611,10 @@ var require_non_secure = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30200
30611
|
};
|
|
30201
30612
|
}));
|
|
30202
30613
|
//#endregion
|
|
30203
|
-
//#region (ignored) node_modules/.pnpm/postcss@8.5.
|
|
30614
|
+
//#region (ignored) node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib
|
|
30204
30615
|
var require_lib = /* @__PURE__ */ __commonJSMin((() => {}));
|
|
30205
30616
|
//#endregion
|
|
30206
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
30617
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/previous-map.js
|
|
30207
30618
|
var require_previous_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30208
30619
|
init__polyfill_node_buffer();
|
|
30209
30620
|
let { existsSync, readFileSync } = (init__polyfill_node_fs(), __toCommonJS(_polyfill_node_fs_exports));
|
|
@@ -30218,6 +30629,7 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30218
30629
|
var PreviousMap = class {
|
|
30219
30630
|
constructor(css, opts) {
|
|
30220
30631
|
if (opts.map === false) return;
|
|
30632
|
+
if (opts.unsafeMap) this.unsafeMap = true;
|
|
30221
30633
|
this.loadAnnotation(css);
|
|
30222
30634
|
this.inline = this.startWith(this.annotation, "data:");
|
|
30223
30635
|
let prev = opts.map ? opts.map.prev : void 0;
|
|
@@ -30227,7 +30639,7 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30227
30639
|
if (text) this.text = text;
|
|
30228
30640
|
}
|
|
30229
30641
|
consumer() {
|
|
30230
|
-
if (!this.consumerCache) this.consumerCache = new SourceMapConsumer(this.text);
|
|
30642
|
+
if (!this.consumerCache) this.consumerCache = new SourceMapConsumer(this.json || this.text);
|
|
30231
30643
|
return this.consumerCache;
|
|
30232
30644
|
}
|
|
30233
30645
|
decodeInline(text) {
|
|
@@ -30255,7 +30667,11 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30255
30667
|
let end = css.indexOf("*/", start);
|
|
30256
30668
|
if (start > -1 && end > -1) this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
30257
30669
|
}
|
|
30258
|
-
loadFile(path) {
|
|
30670
|
+
loadFile(path, cssFile, trusted) {
|
|
30671
|
+
/* c8 ignore next 5 */
|
|
30672
|
+
if (!trusted && !this.unsafeMap) {
|
|
30673
|
+
if (!/\.map$/i.test(path)) return;
|
|
30674
|
+
}
|
|
30259
30675
|
this.root = dirname(path);
|
|
30260
30676
|
if (existsSync(path)) {
|
|
30261
30677
|
this.mapFile = path;
|
|
@@ -30268,7 +30684,7 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30268
30684
|
else if (typeof prev === "function") {
|
|
30269
30685
|
let prevPath = prev(file);
|
|
30270
30686
|
if (prevPath) {
|
|
30271
|
-
let map = this.loadFile(prevPath);
|
|
30687
|
+
let map = this.loadFile(prevPath, file, true);
|
|
30272
30688
|
if (!map) throw new Error("Unable to load previous source map: " + prevPath.toString());
|
|
30273
30689
|
return map;
|
|
30274
30690
|
}
|
|
@@ -30280,7 +30696,14 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30280
30696
|
else if (this.annotation) {
|
|
30281
30697
|
let map = this.annotation;
|
|
30282
30698
|
if (file) map = join(dirname(file), map);
|
|
30283
|
-
|
|
30699
|
+
let unknown = this.loadFile(map, file, false);
|
|
30700
|
+
if (unknown) try {
|
|
30701
|
+
/* c8 ignore next 4 */
|
|
30702
|
+
this.json = JSON.parse(unknown.replace(/^\)]}'[^\n]*\n/, ""));
|
|
30703
|
+
} catch (_unused) {
|
|
30704
|
+
return;
|
|
30705
|
+
}
|
|
30706
|
+
return unknown;
|
|
30284
30707
|
}
|
|
30285
30708
|
}
|
|
30286
30709
|
startWith(string, start) {
|
|
@@ -30295,7 +30718,7 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30295
30718
|
PreviousMap.default = PreviousMap;
|
|
30296
30719
|
}));
|
|
30297
30720
|
//#endregion
|
|
30298
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
30721
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/input.js
|
|
30299
30722
|
var require_input = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30300
30723
|
init_objectSpread2();
|
|
30301
30724
|
let { nanoid } = require_non_secure();
|
|
@@ -30488,7 +30911,7 @@ var require_input = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30488
30911
|
if (terminalHighlight && terminalHighlight.registerInput) terminalHighlight.registerInput(Input);
|
|
30489
30912
|
}));
|
|
30490
30913
|
//#endregion
|
|
30491
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
30914
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/root.js
|
|
30492
30915
|
var require_root$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30493
30916
|
let Container = require_container$1();
|
|
30494
30917
|
let LazyResult, Processor;
|
|
@@ -30527,7 +30950,7 @@ var require_root$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30527
30950
|
Container.registerRoot(Root);
|
|
30528
30951
|
}));
|
|
30529
30952
|
//#endregion
|
|
30530
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
30953
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/list.js
|
|
30531
30954
|
var require_list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30532
30955
|
let list = {
|
|
30533
30956
|
comma(string) {
|
|
@@ -30576,7 +30999,7 @@ var require_list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30576
30999
|
list.default = list;
|
|
30577
31000
|
}));
|
|
30578
31001
|
//#endregion
|
|
30579
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
31002
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/rule.js
|
|
30580
31003
|
var require_rule = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30581
31004
|
let Container = require_container$1();
|
|
30582
31005
|
let list = require_list();
|
|
@@ -30600,7 +31023,7 @@ var require_rule = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30600
31023
|
Container.registerRule(Rule);
|
|
30601
31024
|
}));
|
|
30602
31025
|
//#endregion
|
|
30603
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
31026
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/fromJSON.js
|
|
30604
31027
|
var require_fromJSON = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30605
31028
|
init_objectWithoutProperties();
|
|
30606
31029
|
init_objectSpread2();
|
|
@@ -30640,7 +31063,7 @@ var require_fromJSON = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30640
31063
|
fromJSON.default = fromJSON;
|
|
30641
31064
|
}));
|
|
30642
31065
|
//#endregion
|
|
30643
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
31066
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/map-generator.js
|
|
30644
31067
|
var require_map_generator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30645
31068
|
init__polyfill_node_buffer();
|
|
30646
31069
|
let { dirname, relative, resolve, sep } = (init__polyfill_node_path(), __toCommonJS(_polyfill_node_path_exports));
|
|
@@ -30909,7 +31332,7 @@ var require_map_generator = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
30909
31332
|
module.exports = MapGenerator;
|
|
30910
31333
|
}));
|
|
30911
31334
|
//#endregion
|
|
30912
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
31335
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/tokenize.js
|
|
30913
31336
|
var require_tokenize$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30914
31337
|
const SINGLE_QUOTE = "'".charCodeAt(0);
|
|
30915
31338
|
const DOUBLE_QUOTE = "\"".charCodeAt(0);
|
|
@@ -30943,6 +31366,7 @@ var require_tokenize$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30943
31366
|
let pos = 0;
|
|
30944
31367
|
let buffer = [];
|
|
30945
31368
|
let returned = [];
|
|
31369
|
+
let lastBadParen = -1;
|
|
30946
31370
|
function position() {
|
|
30947
31371
|
return pos;
|
|
30948
31372
|
}
|
|
@@ -31011,15 +31435,22 @@ var require_tokenize$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31011
31435
|
next
|
|
31012
31436
|
];
|
|
31013
31437
|
pos = next;
|
|
31014
|
-
} else
|
|
31438
|
+
} else if (pos <= lastBadParen) currentToken = [
|
|
31439
|
+
"(",
|
|
31440
|
+
"(",
|
|
31441
|
+
pos
|
|
31442
|
+
];
|
|
31443
|
+
else {
|
|
31015
31444
|
next = css.indexOf(")", pos + 1);
|
|
31016
31445
|
content = css.slice(pos, next + 1);
|
|
31017
|
-
if (next === -1 || RE_BAD_BRACKET.test(content))
|
|
31018
|
-
|
|
31019
|
-
|
|
31020
|
-
|
|
31021
|
-
|
|
31022
|
-
|
|
31446
|
+
if (next === -1 || RE_BAD_BRACKET.test(content)) {
|
|
31447
|
+
lastBadParen = next === -1 ? length : next;
|
|
31448
|
+
currentToken = [
|
|
31449
|
+
"(",
|
|
31450
|
+
"(",
|
|
31451
|
+
pos
|
|
31452
|
+
];
|
|
31453
|
+
} else {
|
|
31023
31454
|
currentToken = [
|
|
31024
31455
|
"brackets",
|
|
31025
31456
|
content,
|
|
@@ -31134,7 +31565,7 @@ var require_tokenize$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31134
31565
|
};
|
|
31135
31566
|
}));
|
|
31136
31567
|
//#endregion
|
|
31137
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
31568
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/parser.js
|
|
31138
31569
|
var require_parser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31139
31570
|
let AtRule = require_at_rule();
|
|
31140
31571
|
let Comment = require_comment$1();
|
|
@@ -31587,7 +32018,7 @@ var require_parser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31587
32018
|
module.exports = Parser;
|
|
31588
32019
|
}));
|
|
31589
32020
|
//#endregion
|
|
31590
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32021
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/parse.js
|
|
31591
32022
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31592
32023
|
let Container = require_container$1();
|
|
31593
32024
|
let Input = require_input();
|
|
@@ -31611,7 +32042,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31611
32042
|
Container.registerParse(parse);
|
|
31612
32043
|
}));
|
|
31613
32044
|
//#endregion
|
|
31614
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32045
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/warning.js
|
|
31615
32046
|
var require_warning = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31616
32047
|
var Warning = class {
|
|
31617
32048
|
constructor(text, opts = {}) {
|
|
@@ -31640,7 +32071,7 @@ var require_warning = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31640
32071
|
Warning.default = Warning;
|
|
31641
32072
|
}));
|
|
31642
32073
|
//#endregion
|
|
31643
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32074
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/result.js
|
|
31644
32075
|
var require_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31645
32076
|
let Warning = require_warning();
|
|
31646
32077
|
var Result = class {
|
|
@@ -31674,7 +32105,7 @@ var require_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31674
32105
|
Result.default = Result;
|
|
31675
32106
|
}));
|
|
31676
32107
|
//#endregion
|
|
31677
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32108
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/warn-once.js
|
|
31678
32109
|
var require_warn_once = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31679
32110
|
let printed = {};
|
|
31680
32111
|
module.exports = function warnOnce(message) {
|
|
@@ -31684,7 +32115,7 @@ var require_warn_once = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31684
32115
|
};
|
|
31685
32116
|
}));
|
|
31686
32117
|
//#endregion
|
|
31687
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32118
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/lazy-result.js
|
|
31688
32119
|
var require_lazy_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31689
32120
|
init_objectSpread2();
|
|
31690
32121
|
init_asyncToGenerator();
|
|
@@ -31970,6 +32401,15 @@ var require_lazy_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31970
32401
|
if (opts.syntax) str = opts.syntax.stringify;
|
|
31971
32402
|
if (opts.stringifier) str = opts.stringifier;
|
|
31972
32403
|
if (str.stringify) str = str.stringify;
|
|
32404
|
+
let rootSource = this.result.root.source;
|
|
32405
|
+
if (opts.map === void 0 && !(rootSource && rootSource.input && rootSource.input.map)) {
|
|
32406
|
+
let result = "";
|
|
32407
|
+
str(this.result.root, (i) => {
|
|
32408
|
+
result += i;
|
|
32409
|
+
});
|
|
32410
|
+
this.result.css = result;
|
|
32411
|
+
return this.result;
|
|
32412
|
+
}
|
|
31973
32413
|
let data = new MapGenerator(str, this.result.root, this.result.opts).generate();
|
|
31974
32414
|
this.result.css = data[0];
|
|
31975
32415
|
this.result.map = data[1];
|
|
@@ -32092,7 +32532,7 @@ var require_lazy_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32092
32532
|
Document.registerLazyResult(LazyResult);
|
|
32093
32533
|
}));
|
|
32094
32534
|
//#endregion
|
|
32095
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32535
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/no-work-result.js
|
|
32096
32536
|
var require_no_work_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32097
32537
|
let MapGenerator = require_map_generator();
|
|
32098
32538
|
let parse = require_parse();
|
|
@@ -32189,7 +32629,7 @@ var require_no_work_result = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
32189
32629
|
NoWorkResult.default = NoWorkResult;
|
|
32190
32630
|
}));
|
|
32191
32631
|
//#endregion
|
|
32192
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32632
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/processor.js
|
|
32193
32633
|
var require_processor$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32194
32634
|
let Document = require_document();
|
|
32195
32635
|
let LazyResult = require_lazy_result();
|
|
@@ -32197,7 +32637,7 @@ var require_processor$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32197
32637
|
let Root = require_root$1();
|
|
32198
32638
|
var Processor = class {
|
|
32199
32639
|
constructor(plugins = []) {
|
|
32200
|
-
this.version = "8.5.
|
|
32640
|
+
this.version = "8.5.14";
|
|
32201
32641
|
this.plugins = this.normalize(plugins);
|
|
32202
32642
|
}
|
|
32203
32643
|
normalize(plugins) {
|
|
@@ -32228,7 +32668,7 @@ var require_processor$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32228
32668
|
Document.registerProcessor(Processor);
|
|
32229
32669
|
}));
|
|
32230
32670
|
//#endregion
|
|
32231
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32671
|
+
//#region node_modules/.pnpm/postcss@8.5.14/node_modules/postcss/lib/postcss.mjs
|
|
32232
32672
|
var import_postcss = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32233
32673
|
init__polyfill_node_process();
|
|
32234
32674
|
let AtRule = require_at_rule();
|
|
@@ -35405,6 +35845,8 @@ function processRule(id, rule) {
|
|
|
35405
35845
|
function rewriteSelector(id, rule, selector, selectorRoot, deep, slotted = false) {
|
|
35406
35846
|
let node = null;
|
|
35407
35847
|
let shouldInject = !deep;
|
|
35848
|
+
let hasNestedDeep = false;
|
|
35849
|
+
let splitForNestedDeep = false;
|
|
35408
35850
|
selector.each((n) => {
|
|
35409
35851
|
if (n.type === "combinator" && (n.value === ">>>" || n.value === "/deep/")) {
|
|
35410
35852
|
n.value = " ";
|
|
@@ -35414,6 +35856,25 @@ function rewriteSelector(id, rule, selector, selectorRoot, deep, slotted = false
|
|
|
35414
35856
|
}
|
|
35415
35857
|
if (n.type === "pseudo") {
|
|
35416
35858
|
const { value } = n;
|
|
35859
|
+
if (isDeepContainerPseudo(n)) {
|
|
35860
|
+
if (n.nodes.some((selector) => selector.some(isDeepSelector))) {
|
|
35861
|
+
const hasScopeAnchor = !!node;
|
|
35862
|
+
const hasMixedSelectors = n.nodes.some((selector) => !selector.some(isDeepSelector));
|
|
35863
|
+
const hasTrailingNodes = selector.index(n) < selector.length - 1;
|
|
35864
|
+
if (canSplitDeepContainerPseudo(n) && !deep && !hasScopeAnchor && hasMixedSelectors && hasTrailingNodes) {
|
|
35865
|
+
splitSelectorForNestedDeep(id, rule, selector, selectorRoot, n, deep, slotted);
|
|
35866
|
+
splitForNestedDeep = true;
|
|
35867
|
+
return false;
|
|
35868
|
+
}
|
|
35869
|
+
if (value === ":not" && !deep && !hasScopeAnchor && hasMixedSelectors && hasTrailingNodes) return;
|
|
35870
|
+
n.nodes.forEach((selector) => rewriteSelector(id, rule, selector, selectorRoot, deep || hasScopeAnchor, slotted));
|
|
35871
|
+
if (!hasScopeAnchor) {
|
|
35872
|
+
node = n;
|
|
35873
|
+
shouldInject = false;
|
|
35874
|
+
}
|
|
35875
|
+
hasNestedDeep = true;
|
|
35876
|
+
}
|
|
35877
|
+
}
|
|
35417
35878
|
if (value === ":deep" || value === "::v-deep") {
|
|
35418
35879
|
rule.__deep = true;
|
|
35419
35880
|
if (n.nodes.length) {
|
|
@@ -35464,8 +35925,9 @@ function rewriteSelector(id, rule, selector, selectorRoot, deep, slotted = false
|
|
|
35464
35925
|
}
|
|
35465
35926
|
if (node) return;
|
|
35466
35927
|
}
|
|
35467
|
-
if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where") && !node) node = n;
|
|
35928
|
+
if (!hasNestedDeep && (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where") && !node)) node = n;
|
|
35468
35929
|
});
|
|
35930
|
+
if (splitForNestedDeep) return;
|
|
35469
35931
|
if (rule.nodes.some((node) => node.type === "rule")) {
|
|
35470
35932
|
const deep = rule.__deep;
|
|
35471
35933
|
if (!deep) {
|
|
@@ -35475,7 +35937,7 @@ function rewriteSelector(id, rule, selector, selectorRoot, deep, slotted = false
|
|
|
35475
35937
|
}
|
|
35476
35938
|
shouldInject = deep;
|
|
35477
35939
|
}
|
|
35478
|
-
if (node) {
|
|
35940
|
+
if (node && !hasNestedDeep) {
|
|
35479
35941
|
const { type, value } = node;
|
|
35480
35942
|
if (type === "pseudo" && (value === ":is" || value === ":where")) {
|
|
35481
35943
|
node.nodes.forEach((value) => rewriteSelector(id, rule, value, selectorRoot, deep, slotted));
|
|
@@ -35497,6 +35959,32 @@ function rewriteSelector(id, rule, selector, selectorRoot, deep, slotted = false
|
|
|
35497
35959
|
function isSpaceCombinator(node) {
|
|
35498
35960
|
return node.type === "combinator" && /^\s+$/.test(node.value);
|
|
35499
35961
|
}
|
|
35962
|
+
function isDeepSelector(node) {
|
|
35963
|
+
var _nodes;
|
|
35964
|
+
if (node.type === "pseudo" && (node.value === ":deep" || node.value === "::v-deep")) return true;
|
|
35965
|
+
return !!((_nodes = node.nodes) === null || _nodes === void 0 ? void 0 : _nodes.some((child) => isDeepSelector(child)));
|
|
35966
|
+
}
|
|
35967
|
+
function isDeepContainerPseudo(node) {
|
|
35968
|
+
return node.type === "pseudo" && (node.value === ":is" || node.value === ":where" || node.value === ":has" || node.value === ":not");
|
|
35969
|
+
}
|
|
35970
|
+
function canSplitDeepContainerPseudo(node) {
|
|
35971
|
+
return node.value === ":is" || node.value === ":where" || node.value === ":has";
|
|
35972
|
+
}
|
|
35973
|
+
function splitSelectorForNestedDeep(id, rule, selector, selectorRoot, pseudo, deep, slotted) {
|
|
35974
|
+
const pseudoIndex = selector.index(pseudo);
|
|
35975
|
+
const selectors = pseudo.nodes.map((branch, index) => {
|
|
35976
|
+
const branchSelector = selector.clone();
|
|
35977
|
+
if (branchSelector.first) branchSelector.first.spaces.before = index === 0 ? selector.first.spaces.before : " ";
|
|
35978
|
+
const branchPseudo = branchSelector.at(pseudoIndex);
|
|
35979
|
+
const branchClone = branch.clone();
|
|
35980
|
+
if (branchClone.first) branchClone.first.spaces.before = "";
|
|
35981
|
+
branchPseudo.removeAll();
|
|
35982
|
+
branchPseudo.append(branchClone);
|
|
35983
|
+
rewriteSelector(id, rule, branchSelector, selectorRoot, deep, slotted);
|
|
35984
|
+
return branchSelector;
|
|
35985
|
+
});
|
|
35986
|
+
selector.replaceWith(...selectors);
|
|
35987
|
+
}
|
|
35500
35988
|
function extractAndWrapNodes(parentNode) {
|
|
35501
35989
|
if (!parentNode.nodes) return;
|
|
35502
35990
|
const nodes = parentNode.nodes.filter((node) => node.type === "decl" || node.type === "comment");
|
|
@@ -39039,13 +39527,22 @@ var TypeScope = class {
|
|
|
39039
39527
|
this.exportedDeclares = Object.create(null);
|
|
39040
39528
|
}
|
|
39041
39529
|
};
|
|
39530
|
+
function recordScopeDep(ctx, scope) {
|
|
39531
|
+
if (scope && scope.filename !== ctx.filename) (ctx.deps || (ctx.deps = /* @__PURE__ */ new Set())).add(scope.filename);
|
|
39532
|
+
}
|
|
39533
|
+
function recordResolvedElementDeps(ctx, { props }) {
|
|
39534
|
+
for (const key in props) recordScopeDep(ctx, props[key]._ownerScope);
|
|
39535
|
+
}
|
|
39042
39536
|
/**
|
|
39043
39537
|
* Resolve arbitrary type node to a list of type elements that can be then
|
|
39044
39538
|
* mapped to runtime props or emits.
|
|
39045
39539
|
*/
|
|
39046
39540
|
function resolveTypeElements(ctx, node, scope, typeParameters) {
|
|
39047
39541
|
const canCache = !typeParameters;
|
|
39048
|
-
if (canCache && node._resolvedElements)
|
|
39542
|
+
if (canCache && node._resolvedElements) {
|
|
39543
|
+
recordResolvedElementDeps(ctx, node._resolvedElements);
|
|
39544
|
+
return node._resolvedElements;
|
|
39545
|
+
}
|
|
39049
39546
|
const resolved = innerResolveTypeElements(ctx, node, node._ownerScope || scope || ctxToScope(ctx), typeParameters);
|
|
39050
39547
|
return canCache ? node._resolvedElements = resolved : resolved;
|
|
39051
39548
|
}
|
|
@@ -39307,7 +39804,10 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
|
|
|
39307
39804
|
}
|
|
39308
39805
|
function resolveTypeReference(ctx, node, scope, name, onlyExported = false) {
|
|
39309
39806
|
const canCache = !(scope === null || scope === void 0 ? void 0 : scope.isGenericScope);
|
|
39310
|
-
if (canCache && node._resolvedReference)
|
|
39807
|
+
if (canCache && node._resolvedReference) {
|
|
39808
|
+
recordScopeDep(ctx, node._resolvedReference._ownerScope);
|
|
39809
|
+
return node._resolvedReference;
|
|
39810
|
+
}
|
|
39311
39811
|
const resolved = innerResolveTypeReference(ctx, scope || ctxToScope(ctx), name || getReferenceName(node), node, onlyExported);
|
|
39312
39812
|
return canCache ? node._resolvedReference = resolved : resolved;
|
|
39313
39813
|
}
|
|
@@ -39322,7 +39822,9 @@ function innerResolveTypeReference(ctx, scope, name, node, onlyExported) {
|
|
|
39322
39822
|
const src = node.type === "TSTypeQuery" ? s.declares : s.types;
|
|
39323
39823
|
if (src[name]) {
|
|
39324
39824
|
(ctx.deps || (ctx.deps = /* @__PURE__ */ new Set())).add(s.filename);
|
|
39325
|
-
|
|
39825
|
+
const resolved = src[name];
|
|
39826
|
+
if (resolved._ownerScope && resolved._ownerScope !== s) ctx.deps.add(resolved._ownerScope.filename);
|
|
39827
|
+
return resolved;
|
|
39326
39828
|
}
|
|
39327
39829
|
}
|
|
39328
39830
|
}
|
|
@@ -39387,7 +39889,7 @@ function resolveTypeFromImport(ctx, node, name, scope) {
|
|
|
39387
39889
|
const { source, imported } = scope.imports[name];
|
|
39388
39890
|
return resolveTypeReference(ctx, node, importSourceToScope(ctx, node, scope, source), imported, true);
|
|
39389
39891
|
}
|
|
39390
|
-
function importSourceToScope(ctx, node, scope, source) {
|
|
39892
|
+
function importSourceToScope(ctx, node, scope, source, trackDep = true) {
|
|
39391
39893
|
let fs;
|
|
39392
39894
|
try {
|
|
39393
39895
|
fs = resolveFS(ctx);
|
|
@@ -39400,10 +39902,11 @@ function importSourceToScope(ctx, node, scope, source) {
|
|
|
39400
39902
|
if (source.startsWith("..")) resolved = resolveExt(joinPaths(dirname(scope.filename), source), fs);
|
|
39401
39903
|
else if (source[0] === ".") resolved = resolveExt(joinPaths(dirname(scope.filename), source), fs);
|
|
39402
39904
|
else return ctx.error(`Type import from non-relative sources is not supported in the browser build.`, node, scope);
|
|
39905
|
+
if (!resolved && source[0] === "." && false);
|
|
39403
39906
|
if (resolved) resolved = scope.resolvedImportSources[source] = normalizePath(resolved);
|
|
39404
39907
|
}
|
|
39405
39908
|
if (resolved) {
|
|
39406
|
-
(ctx.deps || (ctx.deps = /* @__PURE__ */ new Set())).add(resolved);
|
|
39909
|
+
if (trackDep) (ctx.deps || (ctx.deps = /* @__PURE__ */ new Set())).add(resolved);
|
|
39407
39910
|
return fileToScope(ctx, resolved);
|
|
39408
39911
|
} else return ctx.error(`Failed to resolve import source ${JSON.stringify(source)}.`, node, scope);
|
|
39409
39912
|
}
|
|
@@ -39501,8 +40004,22 @@ function recordTypes(ctx, body, scope, asGlobal = false) {
|
|
|
39501
40004
|
for (const stmt of body) if (asGlobal) {
|
|
39502
40005
|
if (isAmbient) {
|
|
39503
40006
|
if (stmt.declare) recordType(stmt, types, declares);
|
|
39504
|
-
} else if (stmt.type === "TSModuleDeclaration" && stmt.global) for (const s of stmt.body.body) if (s.type === "ExportNamedDeclaration"
|
|
39505
|
-
|
|
40007
|
+
} else if (stmt.type === "TSModuleDeclaration" && stmt.global) for (const s of stmt.body.body) if (s.type === "ExportNamedDeclaration") {
|
|
40008
|
+
if (s.declaration) recordType(s.declaration, types, declares);
|
|
40009
|
+
else if (s.source) {
|
|
40010
|
+
const sourceScope = importSourceToScope(ctx, s.source, scope, s.source.value, false);
|
|
40011
|
+
for (const spec of s.specifiers) if (spec.type === "ExportSpecifier") {
|
|
40012
|
+
const exported = getId(spec.exported);
|
|
40013
|
+
const local = spec.local.name;
|
|
40014
|
+
if (sourceScope.exportedTypes[local]) types[exported] = sourceScope.exportedTypes[local];
|
|
40015
|
+
if (sourceScope.exportedDeclares[local]) declares[exported] = sourceScope.exportedDeclares[local];
|
|
40016
|
+
}
|
|
40017
|
+
}
|
|
40018
|
+
} else if (s.type === "ExportAllDeclaration" && s.source) {
|
|
40019
|
+
const sourceScope = importSourceToScope(ctx, s.source, scope, s.source.value, false);
|
|
40020
|
+
Object.assign(types, sourceScope.exportedTypes);
|
|
40021
|
+
Object.assign(declares, sourceScope.exportedDeclares);
|
|
40022
|
+
} else recordType(s, types, declares);
|
|
39506
40023
|
} else recordType(stmt, types, declares);
|
|
39507
40024
|
if (!asGlobal) {
|
|
39508
40025
|
for (const stmt of body) if (stmt.type === "ExportNamedDeclaration") {
|
|
@@ -39539,10 +40056,10 @@ function recordTypes(ctx, body, scope, asGlobal = false) {
|
|
|
39539
40056
|
}
|
|
39540
40057
|
for (const key of Object.keys(types)) {
|
|
39541
40058
|
const node = types[key];
|
|
39542
|
-
node._ownerScope = scope;
|
|
39543
|
-
if (node._ns) node._ns._ownerScope = scope;
|
|
40059
|
+
if (!node._ownerScope) node._ownerScope = scope;
|
|
40060
|
+
if (node._ns && !node._ns._ownerScope) node._ns._ownerScope = scope;
|
|
39544
40061
|
}
|
|
39545
|
-
for (const key of Object.keys(declares)) declares[key]._ownerScope = scope;
|
|
40062
|
+
for (const key of Object.keys(declares)) if (!declares[key]._ownerScope) declares[key]._ownerScope = scope;
|
|
39546
40063
|
}
|
|
39547
40064
|
function recordType(node, types, declares, overwriteId) {
|
|
39548
40065
|
switch (node.type) {
|
|
@@ -39667,7 +40184,10 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
39667
40184
|
default: return [UNKNOWN_TYPE];
|
|
39668
40185
|
}
|
|
39669
40186
|
case "TSTypeReference": {
|
|
39670
|
-
|
|
40187
|
+
let resolved;
|
|
40188
|
+
try {
|
|
40189
|
+
resolved = resolveTypeReference(ctx, node, scope);
|
|
40190
|
+
} catch (_unused) {}
|
|
39671
40191
|
if (resolved) {
|
|
39672
40192
|
if (resolved.type === "TSTypeAliasDeclaration") {
|
|
39673
40193
|
if (resolved.typeAnnotation.type === "TSFunctionType") return ["Function"];
|
|
@@ -39743,6 +40263,17 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
39743
40263
|
case "ReadonlyArray": return ["Array"];
|
|
39744
40264
|
case "ReadonlyMap": return ["Map"];
|
|
39745
40265
|
case "ReadonlySet": return ["Set"];
|
|
40266
|
+
case "Ref":
|
|
40267
|
+
case "ShallowRef":
|
|
40268
|
+
case "ComputedRef":
|
|
40269
|
+
case "WritableComputedRef": return ["Object"];
|
|
40270
|
+
case "MaybeRef":
|
|
40271
|
+
case "MaybeRefOrGetter": {
|
|
40272
|
+
const types = new Set(["Object"]);
|
|
40273
|
+
if (node.typeName.name === "MaybeRefOrGetter") types.add("Function");
|
|
40274
|
+
if (node.typeParameters && node.typeParameters.params[0]) for (const t of inferRuntimeType(ctx, node.typeParameters.params[0], scope, false, typeParameters)) types.add(t);
|
|
40275
|
+
return Array.from(types);
|
|
40276
|
+
}
|
|
39746
40277
|
case "NonNullable":
|
|
39747
40278
|
if (node.typeParameters && node.typeParameters.params[0]) return inferRuntimeType(ctx, node.typeParameters.params[0], scope).filter((t) => t !== "null");
|
|
39748
40279
|
break;
|
|
@@ -40782,7 +41313,7 @@ function compileScript(sfc, options) {
|
|
|
40782
41313
|
if (emitsDecl) runtimeOptions += `\n emits: ${emitsDecl},`;
|
|
40783
41314
|
if (vapor && !ssr && sfc.template && !sfc.template.src) {
|
|
40784
41315
|
var _options$templateOpti2;
|
|
40785
|
-
|
|
41316
|
+
if (isMultiRoot(sfc.template.ast, (_options$templateOpti2 = options.templateOptions) === null || _options$templateOpti2 === void 0 ? void 0 : _options$templateOpti2.compilerOptions)) runtimeOptions += `\n __multiRoot: true,`;
|
|
40786
41317
|
}
|
|
40787
41318
|
let definedOptions = "";
|
|
40788
41319
|
if (ctx.optionsRuntimeDecl) definedOptions = scriptSetup.content.slice(ctx.optionsRuntimeDecl.start, ctx.optionsRuntimeDecl.end).trim();
|
|
@@ -40940,7 +41471,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
40940
41471
|
//#endregion
|
|
40941
41472
|
//#region packages/compiler-sfc/src/index.ts
|
|
40942
41473
|
init_objectSpread2();
|
|
40943
|
-
const version = "3.6.0-beta.
|
|
41474
|
+
const version = "3.6.0-beta.12";
|
|
40944
41475
|
const parseCache = parseCache$1;
|
|
40945
41476
|
const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
|
|
40946
41477
|
const walk = walk$2;
|