@vue/compiler-sfc 3.6.0-rc.10 → 3.6.0-rc.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 +1092 -1323
- package/dist/compiler-sfc.esm-browser.js +657 -362
- package/package.json +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-rc.12
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -405,9 +405,10 @@ const isBlockTag = /*@__PURE__*/ makeMap(BLOCK_TAGS);
|
|
|
405
405
|
* - ismap -> isMap
|
|
406
406
|
* - nomodule -> noModule
|
|
407
407
|
* - novalidate -> noValidate
|
|
408
|
+
* - playsinline -> playsInline
|
|
408
409
|
* - readonly -> readOnly
|
|
409
410
|
*/
|
|
410
|
-
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
|
411
|
+
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
|
|
411
412
|
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
|
|
412
413
|
/**
|
|
413
414
|
* The full list is needed during SSR to produce the correct initial markup.
|
|
@@ -3626,7 +3627,7 @@ const errorMessages$1 = {
|
|
|
3626
3627
|
[41]: `v-model is missing expression.`,
|
|
3627
3628
|
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
3628
3629
|
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
3629
|
-
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
3630
|
+
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.\nFor props declared with defineModel(), assign the returned ref to a variable and use v-model on that variable.`,
|
|
3630
3631
|
[45]: `v-model cannot be used on a const binding because it is not writable.`,
|
|
3631
3632
|
[46]: `Error parsing JavaScript expression: `,
|
|
3632
3633
|
[47]: `<KeepAlive> expects exactly one child component.`,
|
|
@@ -3638,7 +3639,7 @@ const errorMessages$1 = {
|
|
|
3638
3639
|
[54]: ``
|
|
3639
3640
|
};
|
|
3640
3641
|
//#endregion
|
|
3641
|
-
//#region node_modules/.pnpm/@babel+parser@7.29.
|
|
3642
|
+
//#region node_modules/.pnpm/@babel+parser@7.29.9/node_modules/@babel/parser/lib/index.js
|
|
3642
3643
|
var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3643
3644
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3644
3645
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
@@ -7072,10 +7073,10 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7072
7073
|
const arrows = [];
|
|
7073
7074
|
while (stack.length !== 0) {
|
|
7074
7075
|
const node = stack.pop();
|
|
7075
|
-
if (node.type === "ArrowFunctionExpression"
|
|
7076
|
+
if (node.type === "ArrowFunctionExpression") {
|
|
7076
7077
|
if (node.typeParameters || !node.returnType) this.finishArrowValidation(node);
|
|
7077
7078
|
else arrows.push(node);
|
|
7078
|
-
stack.push(node.body);
|
|
7079
|
+
if (node.body.type !== "BlockStatement") stack.push(node.body);
|
|
7079
7080
|
} else if (node.type === "ConditionalExpression") {
|
|
7080
7081
|
stack.push(node.consequent);
|
|
7081
7082
|
stack.push(node.alternate);
|
|
@@ -12865,6 +12866,9 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12865
12866
|
}
|
|
12866
12867
|
fillOptionalPropertiesForTSESLint(node) {
|
|
12867
12868
|
switch (node.type) {
|
|
12869
|
+
case "ImportDeclaration":
|
|
12870
|
+
node.phase != null || (node.phase = null);
|
|
12871
|
+
return;
|
|
12868
12872
|
case "ExpressionStatement":
|
|
12869
12873
|
node.directive != null || (node.directive = void 0);
|
|
12870
12874
|
return;
|
|
@@ -17936,7 +17940,7 @@ function createStructuralDirectiveTransform$1(name, fn) {
|
|
|
17936
17940
|
};
|
|
17937
17941
|
}
|
|
17938
17942
|
//#endregion
|
|
17939
|
-
//#region node_modules/.pnpm/source-map-js@1.2.
|
|
17943
|
+
//#region node_modules/.pnpm/source-map-js@1.2.2/node_modules/source-map-js/lib/base64.js
|
|
17940
17944
|
var require_base64$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
17941
17945
|
var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
|
|
17942
17946
|
/**
|
|
@@ -17970,7 +17974,7 @@ var require_base64$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
17970
17974
|
};
|
|
17971
17975
|
}));
|
|
17972
17976
|
//#endregion
|
|
17973
|
-
//#region node_modules/.pnpm/source-map-js@1.2.
|
|
17977
|
+
//#region node_modules/.pnpm/source-map-js@1.2.2/node_modules/source-map-js/lib/base64-vlq.js
|
|
17974
17978
|
var require_base64_vlq$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
17975
17979
|
var base64 = require_base64$1();
|
|
17976
17980
|
var VLQ_BASE_SHIFT = 5;
|
|
@@ -18035,7 +18039,7 @@ var require_base64_vlq$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18035
18039
|
};
|
|
18036
18040
|
}));
|
|
18037
18041
|
//#endregion
|
|
18038
|
-
//#region node_modules/.pnpm/source-map-js@1.2.
|
|
18042
|
+
//#region node_modules/.pnpm/source-map-js@1.2.2/node_modules/source-map-js/lib/util.js
|
|
18039
18043
|
var require_util$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
18040
18044
|
/**
|
|
18041
18045
|
* This is a helper function for getting values from parameter/options
|
|
@@ -18382,7 +18386,7 @@ var require_util$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18382
18386
|
exports.computeSourceURL = computeSourceURL;
|
|
18383
18387
|
}));
|
|
18384
18388
|
//#endregion
|
|
18385
|
-
//#region node_modules/.pnpm/source-map-js@1.2.
|
|
18389
|
+
//#region node_modules/.pnpm/source-map-js@1.2.2/node_modules/source-map-js/lib/array-set.js
|
|
18386
18390
|
var require_array_set$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
18387
18391
|
var util = require_util$2();
|
|
18388
18392
|
var has = Object.prototype.hasOwnProperty;
|
|
@@ -18476,7 +18480,7 @@ var require_array_set$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18476
18480
|
exports.ArraySet = ArraySet;
|
|
18477
18481
|
}));
|
|
18478
18482
|
//#endregion
|
|
18479
|
-
//#region node_modules/.pnpm/source-map-js@1.2.
|
|
18483
|
+
//#region node_modules/.pnpm/source-map-js@1.2.2/node_modules/source-map-js/lib/mapping-list.js
|
|
18480
18484
|
var require_mapping_list$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
18481
18485
|
var util = require_util$2();
|
|
18482
18486
|
/**
|
|
@@ -18545,7 +18549,7 @@ var require_mapping_list$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18545
18549
|
exports.MappingList = MappingList;
|
|
18546
18550
|
}));
|
|
18547
18551
|
//#endregion
|
|
18548
|
-
//#region node_modules/.pnpm/source-map-js@1.2.
|
|
18552
|
+
//#region node_modules/.pnpm/source-map-js@1.2.2/node_modules/source-map-js/lib/source-map-generator.js
|
|
18549
18553
|
var require_source_map_generator$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
18550
18554
|
var base64VLQ = require_base64_vlq$1();
|
|
18551
18555
|
var util = require_util$2();
|
|
@@ -18769,10 +18773,9 @@ var require_source_map_generator$1 = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
18769
18773
|
next = "";
|
|
18770
18774
|
if (mapping.generatedLine !== previousGeneratedLine) {
|
|
18771
18775
|
previousGeneratedColumn = 0;
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
}
|
|
18776
|
+
var lineDelta = mapping.generatedLine - previousGeneratedLine;
|
|
18777
|
+
next += lineDelta === 1 ? ";" : ";".repeat(lineDelta);
|
|
18778
|
+
previousGeneratedLine = mapping.generatedLine;
|
|
18776
18779
|
} else if (i > 0) {
|
|
18777
18780
|
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) continue;
|
|
18778
18781
|
next += ",";
|
|
@@ -18829,7 +18832,7 @@ var require_source_map_generator$1 = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
18829
18832
|
exports.SourceMapGenerator = SourceMapGenerator;
|
|
18830
18833
|
}));
|
|
18831
18834
|
//#endregion
|
|
18832
|
-
//#region node_modules/.pnpm/source-map-js@1.2.
|
|
18835
|
+
//#region node_modules/.pnpm/source-map-js@1.2.2/node_modules/source-map-js/lib/binary-search.js
|
|
18833
18836
|
var require_binary_search$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
18834
18837
|
exports.GREATEST_LOWER_BOUND = 1;
|
|
18835
18838
|
exports.LEAST_UPPER_BOUND = 2;
|
|
@@ -18890,7 +18893,7 @@ var require_binary_search$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18890
18893
|
};
|
|
18891
18894
|
}));
|
|
18892
18895
|
//#endregion
|
|
18893
|
-
//#region node_modules/.pnpm/source-map-js@1.2.
|
|
18896
|
+
//#region node_modules/.pnpm/source-map-js@1.2.2/node_modules/source-map-js/lib/quick-sort.js
|
|
18894
18897
|
var require_quick_sort$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
18895
18898
|
function SortTemplate(comparator) {
|
|
18896
18899
|
/**
|
|
@@ -18953,6 +18956,14 @@ var require_quick_sort$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18953
18956
|
let template = SortTemplate.toString();
|
|
18954
18957
|
return new Function(`return ${template}`)()(comparator);
|
|
18955
18958
|
}
|
|
18959
|
+
let isEvalAllowed = (function() {
|
|
18960
|
+
try {
|
|
18961
|
+
new Function("return 0")();
|
|
18962
|
+
return true;
|
|
18963
|
+
} catch (_unused) {
|
|
18964
|
+
return false;
|
|
18965
|
+
}
|
|
18966
|
+
})();
|
|
18956
18967
|
/**
|
|
18957
18968
|
* Sort the given array in-place with the given comparator function.
|
|
18958
18969
|
*
|
|
@@ -18963,7 +18974,7 @@ var require_quick_sort$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18963
18974
|
*/
|
|
18964
18975
|
let sortCache = /* @__PURE__ */ new WeakMap();
|
|
18965
18976
|
exports.quickSort = function(ary, comparator, start = 0) {
|
|
18966
|
-
let doQuickSort = sortCache.get(comparator);
|
|
18977
|
+
let doQuickSort = isEvalAllowed ? sortCache.get(comparator) : SortTemplate(comparator);
|
|
18967
18978
|
if (doQuickSort === void 0) {
|
|
18968
18979
|
doQuickSort = cloneSort(comparator);
|
|
18969
18980
|
sortCache.set(comparator, doQuickSort);
|
|
@@ -18972,13 +18983,14 @@ var require_quick_sort$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18972
18983
|
};
|
|
18973
18984
|
}));
|
|
18974
18985
|
//#endregion
|
|
18975
|
-
//#region node_modules/.pnpm/source-map-js@1.2.
|
|
18986
|
+
//#region node_modules/.pnpm/source-map-js@1.2.2/node_modules/source-map-js/lib/source-map-consumer.js
|
|
18976
18987
|
var require_source_map_consumer$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
18977
18988
|
var util = require_util$2();
|
|
18978
18989
|
var binarySearch = require_binary_search$1();
|
|
18979
18990
|
var ArraySet = require_array_set$1().ArraySet;
|
|
18980
18991
|
var base64VLQ = require_base64_vlq$1();
|
|
18981
18992
|
var quickSort = require_quick_sort$1().quickSort;
|
|
18993
|
+
var MAX_SECTION_OFFSET_LINE = 1e7;
|
|
18982
18994
|
function SourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
18983
18995
|
var sourceMap = aSourceMap;
|
|
18984
18996
|
if (typeof aSourceMap === "string") sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
@@ -19580,21 +19592,37 @@ var require_source_map_consumer$1 = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
19580
19592
|
line: -1,
|
|
19581
19593
|
column: 0
|
|
19582
19594
|
};
|
|
19595
|
+
var maxOffsetLine = 0;
|
|
19583
19596
|
this._sections = sections.map(function(s) {
|
|
19584
19597
|
if (s.url) throw new Error("Support for url field in sections not implemented.");
|
|
19585
19598
|
var offset = util.getArg(s, "offset");
|
|
19586
19599
|
var offsetLine = util.getArg(offset, "line");
|
|
19587
19600
|
var offsetColumn = util.getArg(offset, "column");
|
|
19601
|
+
if (!isValidOffset(offsetLine) || !isValidOffset(offsetColumn)) throw new Error("Section offset line and column must be non-negative integers.");
|
|
19602
|
+
if (offsetLine > MAX_SECTION_OFFSET_LINE) throw new Error("Section offset line must not exceed " + MAX_SECTION_OFFSET_LINE + ".");
|
|
19588
19603
|
if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) throw new Error("Section offsets must be ordered and non-overlapping.");
|
|
19589
19604
|
lastOffset = offset;
|
|
19605
|
+
var consumer = new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL);
|
|
19606
|
+
var totalOffsetLine = offsetLine + (consumer._maxOffsetLine || 0);
|
|
19607
|
+
if (totalOffsetLine > MAX_SECTION_OFFSET_LINE) throw new Error("Section offset line must not exceed " + MAX_SECTION_OFFSET_LINE + ", including offsets of nested sections.");
|
|
19608
|
+
if (totalOffsetLine > maxOffsetLine) maxOffsetLine = totalOffsetLine;
|
|
19590
19609
|
return {
|
|
19591
19610
|
generatedOffset: {
|
|
19592
19611
|
generatedLine: offsetLine + 1,
|
|
19593
19612
|
generatedColumn: offsetColumn + 1
|
|
19594
19613
|
},
|
|
19595
|
-
consumer
|
|
19614
|
+
consumer
|
|
19596
19615
|
};
|
|
19597
19616
|
});
|
|
19617
|
+
this._maxOffsetLine = maxOffsetLine;
|
|
19618
|
+
}
|
|
19619
|
+
/**
|
|
19620
|
+
* Section offsets come from untrusted input and are used as line/column
|
|
19621
|
+
* numbers, so only accept non-negative safe integers (rejects NaN, Infinity,
|
|
19622
|
+
* strings, fractions, etc).
|
|
19623
|
+
*/
|
|
19624
|
+
function isValidOffset(aValue) {
|
|
19625
|
+
return typeof aValue === "number" && aValue >= 0 && aValue <= 9007199254740991 && Math.floor(aValue) === aValue;
|
|
19598
19626
|
}
|
|
19599
19627
|
IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
|
|
19600
19628
|
IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
|
|
@@ -19607,7 +19635,10 @@ var require_source_map_consumer$1 = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
19607
19635
|
*/
|
|
19608
19636
|
Object.defineProperty(IndexedSourceMapConsumer.prototype, "sources", { get: function() {
|
|
19609
19637
|
var sources = [];
|
|
19610
|
-
for (var i = 0; i < this._sections.length; i++)
|
|
19638
|
+
for (var i = 0; i < this._sections.length; i++) {
|
|
19639
|
+
var sectionSources = this._sections[i].consumer.sources;
|
|
19640
|
+
for (var j = 0; j < sectionSources.length; j++) sources.push(sectionSources[j]);
|
|
19641
|
+
}
|
|
19611
19642
|
return sources;
|
|
19612
19643
|
} });
|
|
19613
19644
|
/**
|
|
@@ -19748,7 +19779,7 @@ var require_source_map_consumer$1 = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
19748
19779
|
exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
|
|
19749
19780
|
}));
|
|
19750
19781
|
//#endregion
|
|
19751
|
-
//#region node_modules/.pnpm/source-map-js@1.2.
|
|
19782
|
+
//#region node_modules/.pnpm/source-map-js@1.2.2/node_modules/source-map-js/lib/source-node.js
|
|
19752
19783
|
var require_source_node$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
19753
19784
|
var SourceMapGenerator = require_source_map_generator$1().SourceMapGenerator;
|
|
19754
19785
|
var util = require_util$2();
|
|
@@ -19814,6 +19845,10 @@ var require_source_node$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19814
19845
|
}
|
|
19815
19846
|
}
|
|
19816
19847
|
while (lastGeneratedLine < mapping.generatedLine) {
|
|
19848
|
+
if (remainingLinesIndex >= remainingLines.length) {
|
|
19849
|
+
lastGeneratedLine = mapping.generatedLine;
|
|
19850
|
+
break;
|
|
19851
|
+
}
|
|
19817
19852
|
node.add(shiftNextLine());
|
|
19818
19853
|
lastGeneratedLine++;
|
|
19819
19854
|
}
|
|
@@ -20945,7 +20980,11 @@ const transformFor = createStructuralDirectiveTransform$1("for", (node, dir, con
|
|
|
20945
20980
|
]),
|
|
20946
20981
|
createCompoundExpression([
|
|
20947
20982
|
`if (_cached && _cached.el`,
|
|
20948
|
-
...keyExp ? [
|
|
20983
|
+
...keyExp ? [
|
|
20984
|
+
` && _cached.key === (`,
|
|
20985
|
+
keyExp,
|
|
20986
|
+
`)`
|
|
20987
|
+
] : [],
|
|
20949
20988
|
` && ${context.helperString(IS_MEMO_SAME)}(_cached, _memo)) return _cached`
|
|
20950
20989
|
]),
|
|
20951
20990
|
createCompoundExpression([`const _item = `, childBlock]),
|
|
@@ -21256,11 +21295,11 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
21256
21295
|
return builtIn;
|
|
21257
21296
|
}
|
|
21258
21297
|
{
|
|
21259
|
-
const fromScope = resolveSlotScopeReference(tag, context);
|
|
21298
|
+
const fromScope = resolveSlotScopeReference$1(tag, context);
|
|
21260
21299
|
if (fromScope) return fromScope;
|
|
21261
21300
|
const dotIndex = tag.indexOf(".");
|
|
21262
21301
|
if (dotIndex > 0) {
|
|
21263
|
-
const ns = resolveSlotScopeReference(tag.slice(0, dotIndex), context);
|
|
21302
|
+
const ns = resolveSlotScopeReference$1(tag.slice(0, dotIndex), context);
|
|
21264
21303
|
if (ns) return ns + tag.slice(dotIndex);
|
|
21265
21304
|
}
|
|
21266
21305
|
}
|
|
@@ -21282,7 +21321,7 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
21282
21321
|
context.components.add(tag);
|
|
21283
21322
|
return toValidAssetId(tag, `component`);
|
|
21284
21323
|
}
|
|
21285
|
-
function resolveSlotScopeReference(name, context) {
|
|
21324
|
+
function resolveSlotScopeReference$1(name, context) {
|
|
21286
21325
|
const camelName = camelize(name);
|
|
21287
21326
|
const PascalName = capitalize(camelName);
|
|
21288
21327
|
const isInSlotScope = (reference) => context.isSlotScopeIdentifier(reference);
|
|
@@ -22343,7 +22382,7 @@ function stringifyNode(node, context) {
|
|
|
22343
22382
|
}
|
|
22344
22383
|
function stringifyElement(node, context) {
|
|
22345
22384
|
let res = `<${node.tag}`;
|
|
22346
|
-
let innerHTML =
|
|
22385
|
+
let innerHTML = void 0;
|
|
22347
22386
|
for (let i = 0; i < node.props.length; i++) {
|
|
22348
22387
|
const p = node.props[i];
|
|
22349
22388
|
if (p.type === 6) {
|
|
@@ -22365,13 +22404,15 @@ function stringifyElement(node, context) {
|
|
|
22365
22404
|
else if (arg === "style") evaluated = stringifyStyle(normalizeStyle(evaluated));
|
|
22366
22405
|
res += ` ${p.arg.content}="${escapeHtml(evaluated)}"`;
|
|
22367
22406
|
}
|
|
22368
|
-
} else if (p.name === "html")
|
|
22369
|
-
|
|
22407
|
+
} else if (p.name === "html") {
|
|
22408
|
+
var _evaluateConstant;
|
|
22409
|
+
innerHTML = (_evaluateConstant = evaluateConstant(p.exp)) !== null && _evaluateConstant !== void 0 ? _evaluateConstant : "";
|
|
22410
|
+
} else if (p.name === "text") innerHTML = escapeHtml(toDisplayString(evaluateConstant(p.exp)));
|
|
22370
22411
|
}
|
|
22371
22412
|
}
|
|
22372
22413
|
if (context.scopeId) res += ` ${context.scopeId}`;
|
|
22373
22414
|
res += `>`;
|
|
22374
|
-
if (innerHTML) res += innerHTML;
|
|
22415
|
+
if (innerHTML !== void 0) res += innerHTML;
|
|
22375
22416
|
else for (let i = 0; i < node.children.length; i++) res += stringifyNode(node.children[i], context);
|
|
22376
22417
|
if (!isVoidTag(node.tag)) res += `</${node.tag}>`;
|
|
22377
22418
|
return res;
|
|
@@ -22778,7 +22819,11 @@ var src_exports$2 = /* @__PURE__ */ __exportAll({
|
|
|
22778
22819
|
walkIdentifiers: () => walkIdentifiers,
|
|
22779
22820
|
warnDeprecation: () => warnDeprecation
|
|
22780
22821
|
});
|
|
22781
|
-
const DOMNodeTransforms = [
|
|
22822
|
+
const DOMNodeTransforms = [
|
|
22823
|
+
transformStyle,
|
|
22824
|
+
transformTransition$1,
|
|
22825
|
+
...[validateHtmlNesting]
|
|
22826
|
+
];
|
|
22782
22827
|
const DOMDirectiveTransforms = {
|
|
22783
22828
|
cloak: noopDirectiveTransform,
|
|
22784
22829
|
html: transformVHtml$1,
|
|
@@ -23292,15 +23337,18 @@ function parse(source, options = {}) {
|
|
|
23292
23337
|
shouldForceReload: (prevImports) => hmrShouldReload(prevImports, descriptor)
|
|
23293
23338
|
};
|
|
23294
23339
|
const errors = [];
|
|
23295
|
-
compiler.parse(source, _objectSpread2(_objectSpread2({
|
|
23340
|
+
const ast = compiler.parse(source, _objectSpread2(_objectSpread2({
|
|
23296
23341
|
parseMode: "sfc",
|
|
23297
23342
|
prefixIdentifiers: true
|
|
23298
23343
|
}, templateParseOptions), {}, { onError: (e) => {
|
|
23299
23344
|
errors.push(e);
|
|
23300
|
-
} }))
|
|
23345
|
+
} }));
|
|
23346
|
+
let emptyScriptSetup;
|
|
23347
|
+
ast.children.forEach((node) => {
|
|
23301
23348
|
if (node.type !== 1) return;
|
|
23302
23349
|
if (ignoreEmpty && node.tag !== "template" && isEmpty(node) && !hasAttr(node, "src")) {
|
|
23303
23350
|
descriptor.vapor || (descriptor.vapor = hasAttr(node, "vapor"));
|
|
23351
|
+
if (node.tag === "script" && (hasAttr(node, "setup") || hasAttr(node, "vapor"))) emptyScriptSetup = node;
|
|
23304
23352
|
return;
|
|
23305
23353
|
}
|
|
23306
23354
|
switch (node.tag) {
|
|
@@ -23338,6 +23386,14 @@ function parse(source, options = {}) {
|
|
|
23338
23386
|
default: descriptor.customBlocks.push(createBlock(node, source, pad));
|
|
23339
23387
|
}
|
|
23340
23388
|
});
|
|
23389
|
+
if (descriptor.vapor && descriptor.script && !descriptor.scriptSetup) {
|
|
23390
|
+
if (emptyScriptSetup) descriptor.scriptSetup = createBlock(emptyScriptSetup, source, pad);
|
|
23391
|
+
else {
|
|
23392
|
+
const err = /* @__PURE__ */ new SyntaxError(`Vapor components with a normal <script> must also include <script setup>, <script vapor>, or <script setup vapor>.`);
|
|
23393
|
+
err.loc = descriptor.script.loc;
|
|
23394
|
+
errors.push(err);
|
|
23395
|
+
}
|
|
23396
|
+
}
|
|
23341
23397
|
if (!descriptor.template && !descriptor.script && !descriptor.scriptSetup) errors.push(/* @__PURE__ */ new SyntaxError(`At least one <template> or <script> is required in a single file component. ${descriptor.filename}`));
|
|
23342
23398
|
if (descriptor.scriptSetup) {
|
|
23343
23399
|
if (descriptor.scriptSetup.src) {
|
|
@@ -24977,32 +25033,34 @@ const IRNodeTypes = {
|
|
|
24977
25033
|
"3": "SET_PROP",
|
|
24978
25034
|
"SET_DYNAMIC_PROPS": 4,
|
|
24979
25035
|
"4": "SET_DYNAMIC_PROPS",
|
|
24980
|
-
"
|
|
24981
|
-
"5": "
|
|
24982
|
-
"
|
|
24983
|
-
"6": "
|
|
24984
|
-
"
|
|
24985
|
-
"7": "
|
|
24986
|
-
"
|
|
24987
|
-
"8": "
|
|
24988
|
-
"
|
|
24989
|
-
"9": "
|
|
24990
|
-
"
|
|
24991
|
-
"10": "
|
|
24992
|
-
"
|
|
24993
|
-
"11": "
|
|
24994
|
-
"
|
|
24995
|
-
"12": "
|
|
24996
|
-
"
|
|
24997
|
-
"13": "
|
|
24998
|
-
"
|
|
24999
|
-
"14": "
|
|
25000
|
-
"
|
|
25001
|
-
"15": "
|
|
25002
|
-
"
|
|
25003
|
-
"16": "
|
|
25004
|
-
"
|
|
25005
|
-
"17": "
|
|
25036
|
+
"SYNC_SELECT_VALUE": 5,
|
|
25037
|
+
"5": "SYNC_SELECT_VALUE",
|
|
25038
|
+
"SET_TEXT": 6,
|
|
25039
|
+
"6": "SET_TEXT",
|
|
25040
|
+
"SET_EVENT": 7,
|
|
25041
|
+
"7": "SET_EVENT",
|
|
25042
|
+
"SET_DYNAMIC_EVENTS": 8,
|
|
25043
|
+
"8": "SET_DYNAMIC_EVENTS",
|
|
25044
|
+
"SET_HTML": 9,
|
|
25045
|
+
"9": "SET_HTML",
|
|
25046
|
+
"SET_TEMPLATE_REF": 10,
|
|
25047
|
+
"10": "SET_TEMPLATE_REF",
|
|
25048
|
+
"INSERT_NODE": 11,
|
|
25049
|
+
"11": "INSERT_NODE",
|
|
25050
|
+
"CREATE_COMPONENT_NODE": 12,
|
|
25051
|
+
"12": "CREATE_COMPONENT_NODE",
|
|
25052
|
+
"SLOT_OUTLET_NODE": 13,
|
|
25053
|
+
"13": "SLOT_OUTLET_NODE",
|
|
25054
|
+
"DIRECTIVE": 14,
|
|
25055
|
+
"14": "DIRECTIVE",
|
|
25056
|
+
"IF": 15,
|
|
25057
|
+
"15": "IF",
|
|
25058
|
+
"FOR": 16,
|
|
25059
|
+
"16": "FOR",
|
|
25060
|
+
"KEY": 17,
|
|
25061
|
+
"17": "KEY",
|
|
25062
|
+
"GET_TEXT_CHILD": 18,
|
|
25063
|
+
"18": "GET_TEXT_CHILD"
|
|
25006
25064
|
};
|
|
25007
25065
|
var TemplateRegistry = class {
|
|
25008
25066
|
constructor() {
|
|
@@ -25024,7 +25082,7 @@ const DynamicFlag = {
|
|
|
25024
25082
|
};
|
|
25025
25083
|
function isBlockOperation(op) {
|
|
25026
25084
|
const type = op.type;
|
|
25027
|
-
return type ===
|
|
25085
|
+
return type === 12 || type === 13 || type === 15 || type === 17 || type === 16;
|
|
25028
25086
|
}
|
|
25029
25087
|
//#endregion
|
|
25030
25088
|
//#region packages/compiler-vapor/src/transforms/utils.ts
|
|
@@ -25087,11 +25145,11 @@ const findDir = findDir$1;
|
|
|
25087
25145
|
function propToExpression(prop) {
|
|
25088
25146
|
return prop.type === 6 ? prop.value ? createSimpleExpression(prop.value.content, true, prop.value.loc) : EMPTY_EXPRESSION : prop.exp;
|
|
25089
25147
|
}
|
|
25090
|
-
function isConstantExpression(exp) {
|
|
25091
|
-
return isLiteralWhitelisted(exp.content) || isGloballyAllowed(exp.content) || getLiteralExpressionValue(exp) !== null;
|
|
25148
|
+
function isConstantExpression(exp, bindings) {
|
|
25149
|
+
return isLiteralWhitelisted(exp.content) || isGloballyAllowed(exp.content) && !(bindings && bindings[exp.content]) || getLiteralExpressionValue(exp) !== null;
|
|
25092
25150
|
}
|
|
25093
25151
|
function isConstantBinding$1(exp, bindings) {
|
|
25094
|
-
return isConstantExpression(exp) || isStaticExpression(exp, bindings);
|
|
25152
|
+
return isConstantExpression(exp, bindings) || isStaticExpression(exp, bindings);
|
|
25095
25153
|
}
|
|
25096
25154
|
function isStaticExpression(node, bindings) {
|
|
25097
25155
|
if (node.ast) return isConstantNode(node.ast, bindings);
|
|
@@ -25167,7 +25225,7 @@ function isBuiltInComponent(tag) {
|
|
|
25167
25225
|
function getBlockShape(block) {
|
|
25168
25226
|
if (block.returns.length !== 1) return 2;
|
|
25169
25227
|
const root = block.dynamic.children.find((c) => c.id === block.returns[0]);
|
|
25170
|
-
if (root && root.operation && root.operation.type ===
|
|
25228
|
+
if (root && root.operation && root.operation.type === 15) return 2;
|
|
25171
25229
|
return block.node.type === 1 && block.node.children.every((child) => child.type === 2 || child.type === 5) ? 2 : 1;
|
|
25172
25230
|
}
|
|
25173
25231
|
//#endregion
|
|
@@ -25305,7 +25363,7 @@ var TransformContext = class TransformContext {
|
|
|
25305
25363
|
}
|
|
25306
25364
|
registerEffect(expressions, operation, getIndex, preserveOrder = false) {
|
|
25307
25365
|
const operations = [operation].flat();
|
|
25308
|
-
expressions = expressions.filter((exp) => !isConstantExpression(exp));
|
|
25366
|
+
expressions = expressions.filter((exp) => !isConstantExpression(exp, this.root.options.bindingMetadata));
|
|
25309
25367
|
const once = expressions.every((e) => isConstantBinding$1(e, this.root.options.bindingMetadata));
|
|
25310
25368
|
const needsEffect = operations.some((op) => op.type === 4 && op.listeners);
|
|
25311
25369
|
if (this.inVOnce || once && !preserveOrder && !needsEffect) {
|
|
@@ -25694,12 +25752,19 @@ function genExpression(node, context, assignment, asParams = false) {
|
|
|
25694
25752
|
-2,
|
|
25695
25753
|
loc
|
|
25696
25754
|
]];
|
|
25697
|
-
if (!
|
|
25755
|
+
if (!content.trim()) return [[
|
|
25756
|
+
"void 0",
|
|
25757
|
+
-2,
|
|
25758
|
+
loc
|
|
25759
|
+
]];
|
|
25760
|
+
if (ast === false || ast === void 0 || isConstantExpression(node, options.bindingMetadata)) return [[
|
|
25698
25761
|
content,
|
|
25699
25762
|
-2,
|
|
25700
25763
|
loc
|
|
25701
25764
|
], assignment && ` = ${assignment}`];
|
|
25702
25765
|
if (ast === null) return genIdentifier(content, context, loc, assignment);
|
|
25766
|
+
const target = assignment ? unwrapTSNode(ast) : void 0;
|
|
25767
|
+
const isMemberTarget = (target === null || target === void 0 ? void 0 : target.type) === "MemberExpression" || (target === null || target === void 0 ? void 0 : target.type) === "OptionalMemberExpression";
|
|
25703
25768
|
const ids = [];
|
|
25704
25769
|
const parentStackMap = /* @__PURE__ */ new Map();
|
|
25705
25770
|
const parentStack = [];
|
|
@@ -25710,7 +25775,6 @@ function genExpression(node, context, assignment, asParams = false) {
|
|
|
25710
25775
|
ids.push(id);
|
|
25711
25776
|
parentStackMap.set(id, parentStack.slice());
|
|
25712
25777
|
}, asParams, parentStack);
|
|
25713
|
-
let hasMemberExpression = false;
|
|
25714
25778
|
if (ids.length) {
|
|
25715
25779
|
const [frag, push] = buildCodeFragment();
|
|
25716
25780
|
let lastEnd = 0;
|
|
@@ -25729,16 +25793,21 @@ function genExpression(node, context, assignment, asParams = false) {
|
|
|
25729
25793
|
if (start < lastEnd) return;
|
|
25730
25794
|
const leadingText = content.slice(lastEnd, start);
|
|
25731
25795
|
if (leadingText.length) push([leadingText, -3]);
|
|
25732
|
-
hasMemberExpression || (hasMemberExpression = parent && (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression"));
|
|
25733
25796
|
push(...genIdentifier(asParams ? id.name : source, context, {
|
|
25734
25797
|
start: advancePositionWithClone(node.loc.start, source, start),
|
|
25735
25798
|
end: advancePositionWithClone(node.loc.start, source, end),
|
|
25736
25799
|
source
|
|
25737
|
-
},
|
|
25800
|
+
}, isMemberTarget ? void 0 : assignment, id, parent, parentStack, node));
|
|
25738
25801
|
lastEnd = end;
|
|
25739
25802
|
});
|
|
25740
25803
|
if (lastEnd < content.length) push([content.slice(lastEnd), -3]);
|
|
25741
|
-
if (assignment &&
|
|
25804
|
+
if (assignment && isMemberTarget) {
|
|
25805
|
+
if (TS_NODE_TYPES.includes(ast.type)) {
|
|
25806
|
+
frag.unshift("(");
|
|
25807
|
+
push(")");
|
|
25808
|
+
}
|
|
25809
|
+
push(` = ${assignment}`);
|
|
25810
|
+
}
|
|
25742
25811
|
return frag;
|
|
25743
25812
|
} else return [[
|
|
25744
25813
|
content,
|
|
@@ -25767,7 +25836,8 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, s
|
|
|
25767
25836
|
} else return genExpression(replacement, context, assignment);
|
|
25768
25837
|
}
|
|
25769
25838
|
let prefix;
|
|
25770
|
-
|
|
25839
|
+
let type = bindingMetadata && bindingMetadata[raw];
|
|
25840
|
+
if (inline && !type && raw[0] !== "$" && isSimpleIdentifier(raw) && canPrefix(raw)) type = "props";
|
|
25771
25841
|
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack || []);
|
|
25772
25842
|
const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
|
|
25773
25843
|
const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
|
|
@@ -25786,7 +25856,7 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, s
|
|
|
25786
25856
|
end: advancePositionWithClone(source.loc.start, sourceContent, rightEnd),
|
|
25787
25857
|
source: rightContent
|
|
25788
25858
|
});
|
|
25789
|
-
rightExp.ast =
|
|
25859
|
+
rightExp.ast = isSimpleIdentifier(rightContent) ? null : (0, import_lib.parseExpression)(`(${rightContent})`, _objectSpread2(_objectSpread2({}, getParserOptions(context.options.expressionPlugins)), {}, { sourceType: "module" }));
|
|
25790
25860
|
return [
|
|
25791
25861
|
prefix,
|
|
25792
25862
|
`${helper("isRef")}(${raw}) ? ${raw}.value ${operator} `,
|
|
@@ -25821,7 +25891,7 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, s
|
|
|
25821
25891
|
default: raw = withAssignment(raw);
|
|
25822
25892
|
}
|
|
25823
25893
|
else {
|
|
25824
|
-
if (canPrefix(raw)) {
|
|
25894
|
+
if (type || canPrefix(raw)) {
|
|
25825
25895
|
if (type === "props-aliased") raw = `$props['${bindingMetadata.__propsAliases[raw]}']`;
|
|
25826
25896
|
else raw = `${type === "props" ? "$props" : "_ctx"}.${raw}`;
|
|
25827
25897
|
}
|
|
@@ -25837,7 +25907,8 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, s
|
|
|
25837
25907
|
return assignment ? `${s} = ${assignment}` : s;
|
|
25838
25908
|
}
|
|
25839
25909
|
function unref() {
|
|
25840
|
-
|
|
25910
|
+
const wrapped = `${helper("unref")}(${raw})`;
|
|
25911
|
+
return parentStack && isInNewExpression(parentStack) ? `(${wrapped})` : wrapped;
|
|
25841
25912
|
}
|
|
25842
25913
|
}
|
|
25843
25914
|
function canPrefix(name) {
|
|
@@ -26157,10 +26228,15 @@ function getIdentifierRanges(exp) {
|
|
|
26157
26228
|
return identifiers;
|
|
26158
26229
|
}
|
|
26159
26230
|
function applyContentReplacements(content, replacements) {
|
|
26160
|
-
replacements.sort((a, b) =>
|
|
26161
|
-
|
|
26162
|
-
|
|
26163
|
-
|
|
26231
|
+
replacements.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
26232
|
+
let result = "";
|
|
26233
|
+
let offset = 0;
|
|
26234
|
+
for (const { start, end, content: replacement } of replacements) {
|
|
26235
|
+
if (start < offset) continue;
|
|
26236
|
+
result += content.slice(offset, start) + replacement;
|
|
26237
|
+
offset = end;
|
|
26238
|
+
}
|
|
26239
|
+
return result + content.slice(offset);
|
|
26164
26240
|
}
|
|
26165
26241
|
function genDeclarations(declarations, context, shouldDeclare) {
|
|
26166
26242
|
const [frag, push] = buildCodeFragment();
|
|
@@ -26191,7 +26267,7 @@ function parseExp(context, content) {
|
|
|
26191
26267
|
return (0, import_lib.parseExpression)(`(${content})`, getParserOptions(context.options.expressionPlugins));
|
|
26192
26268
|
}
|
|
26193
26269
|
function genVarName(exp) {
|
|
26194
|
-
return `${exp.replace(/[^a-zA-Z0-9]/g, "_").replace(/_+/g, "_").replace(/_+$/, "")}`;
|
|
26270
|
+
return `${exp.replace(/[^a-zA-Z0-9]/g, "_").replace(/_+/g, "_").replace(/_+$/, "").replace(/^\d/, "_$&")}`;
|
|
26195
26271
|
}
|
|
26196
26272
|
function getUniqueDeclarationName(baseName, reservedNames) {
|
|
26197
26273
|
const normalizedBase = baseName || "exp";
|
|
@@ -26265,7 +26341,7 @@ function genSetEvent(oper, context) {
|
|
|
26265
26341
|
const eventOptions = genEventOptions();
|
|
26266
26342
|
return [NEWLINE, ...genCall(helper(effect ? "onBinding" : delegate ? "delegate" : "on"), `n${element}`, name, genHandler(), eventOptions)];
|
|
26267
26343
|
function genHandler() {
|
|
26268
|
-
return handler || (handler = genEventHandler(context, [value], modifiers));
|
|
26344
|
+
return handler || (handler = genEventHandler(context, [value], modifiers, { hoisted: oper }));
|
|
26269
26345
|
}
|
|
26270
26346
|
function genInvoker() {
|
|
26271
26347
|
return [
|
|
@@ -26300,18 +26376,38 @@ function genSetEvent(oper, context) {
|
|
|
26300
26376
|
return genMulti(DELIMITERS_OBJECT_NEWLINE, ...options.map((option) => [`${option}: true`]));
|
|
26301
26377
|
}
|
|
26302
26378
|
function isSameDelegateEvent(op) {
|
|
26303
|
-
if (op.type ===
|
|
26379
|
+
if (op.type === 7 && op !== oper && op.delegate && op.element === oper.element && op.key.content === key.content) return true;
|
|
26304
26380
|
}
|
|
26305
26381
|
}
|
|
26306
26382
|
function genSetDynamicEvents(oper, context) {
|
|
26307
26383
|
const { helper } = context;
|
|
26308
26384
|
return [NEWLINE, ...genCall(helper("setDynamicEvents"), `n${oper.element}`, genExpression(oper.event, context))];
|
|
26309
26385
|
}
|
|
26386
|
+
const hoistedHandlers = /* @__PURE__ */ new WeakMap();
|
|
26387
|
+
function genHoistedHandlers(effects, context) {
|
|
26388
|
+
const [frag, push] = buildCodeFragment();
|
|
26389
|
+
const declare = (node, key, values, modifiers) => {
|
|
26390
|
+
const name = getUniqueHandlerName(context, `_on_${key.content.replace(/-/g, "_")}`);
|
|
26391
|
+
hoistedHandlers.set(node, name);
|
|
26392
|
+
push(NEWLINE, `const ${name} = `, ...genEventHandler(context, values, modifiers));
|
|
26393
|
+
};
|
|
26394
|
+
for (const { operations } of effects) for (const oper of operations) if (oper.type === 7) declare(oper, oper.key, [oper.value], oper.modifiers);
|
|
26395
|
+
else if (oper.type === 4) for (const props of oper.props) {
|
|
26396
|
+
if (!isArray$3(props)) continue;
|
|
26397
|
+
for (const prop of props) if (prop.handler) declare(prop, prop.key, prop.values, prop.handlerModifiers);
|
|
26398
|
+
}
|
|
26399
|
+
return frag;
|
|
26400
|
+
}
|
|
26401
|
+
function getUniqueHandlerName(context, name) {
|
|
26402
|
+
return context.getUniqueLocalName(genVarName(name));
|
|
26403
|
+
}
|
|
26310
26404
|
function genEventHandler(context, values, modifiers = {
|
|
26311
26405
|
nonKeys: [],
|
|
26312
26406
|
keys: []
|
|
26313
26407
|
}, options = {}) {
|
|
26314
|
-
const { asComponentProp = false, extraWrap = false, modifierHelper = "runtime" } = options;
|
|
26408
|
+
const { asComponentProp = false, extraWrap = false, modifierHelper = "runtime", hoisted } = options;
|
|
26409
|
+
const hoistedName = hoisted && hoistedHandlers.get(hoisted);
|
|
26410
|
+
if (hoistedName) return [hoistedName];
|
|
26315
26411
|
const useVaporModifierHelper = modifierHelper === "vapor";
|
|
26316
26412
|
let handlerExp = [];
|
|
26317
26413
|
if (values) {
|
|
@@ -26496,7 +26592,7 @@ function isFragmentBlock(block) {
|
|
|
26496
26592
|
const child = getSingleReturnedChild(block);
|
|
26497
26593
|
const operation = child && child.operation;
|
|
26498
26594
|
if (!operation) return false;
|
|
26499
|
-
return operation.type ===
|
|
26595
|
+
return operation.type === 13 || operation.type === 16 || operation.type === 17 || operation.type === 15 && !operation.once || operation.type === 12 && !!operation.dynamic && !operation.dynamic.isStatic;
|
|
26500
26596
|
}
|
|
26501
26597
|
function getSingleReturnedChild(block) {
|
|
26502
26598
|
if (block.returns.length !== 1) return;
|
|
@@ -26514,50 +26610,55 @@ function parseValueDestructure(value, context) {
|
|
|
26514
26610
|
const map = /* @__PURE__ */ new Map();
|
|
26515
26611
|
if (value) {
|
|
26516
26612
|
const rawValue = value.content;
|
|
26517
|
-
if (value.ast)
|
|
26518
|
-
|
|
26519
|
-
|
|
26520
|
-
|
|
26521
|
-
|
|
26522
|
-
|
|
26523
|
-
|
|
26524
|
-
|
|
26525
|
-
|
|
26526
|
-
|
|
26527
|
-
if (parent.
|
|
26528
|
-
|
|
26529
|
-
|
|
26530
|
-
path += `[${rawValue.slice(parent.key.start - 1, parent.key.end - 1)}]`;
|
|
26531
|
-
} else path += `.${parent.key.name}`;
|
|
26532
|
-
} else if (parent.type === "ArrayPattern") {
|
|
26533
|
-
const index = parent.elements.indexOf(child);
|
|
26534
|
-
if (child.type === "RestElement") path += `.slice(${index})`;
|
|
26535
|
-
else path += `[${index}]`;
|
|
26536
|
-
} else if (parent.type === "ObjectPattern" && child.type === "RestElement") {
|
|
26537
|
-
helper = context.helper("getRestElement");
|
|
26538
|
-
helperArgs = "[" + parent.properties.filter((p) => p.type === "ObjectProperty").map((p) => {
|
|
26539
|
-
if (p.key.type === "StringLiteral") return JSON.stringify(p.key.value);
|
|
26540
|
-
else if (p.computed) {
|
|
26613
|
+
if (value.ast) {
|
|
26614
|
+
const bindings = /* @__PURE__ */ new Set();
|
|
26615
|
+
walkFunctionParams(value.ast, (id) => bindings.add(id));
|
|
26616
|
+
walkIdentifiers(value.ast, (id, _, parentStack) => {
|
|
26617
|
+
if (bindings.has(id)) {
|
|
26618
|
+
const steps = [];
|
|
26619
|
+
let isDynamic = false;
|
|
26620
|
+
for (let i = 0; i < parentStack.length; i++) {
|
|
26621
|
+
const parent = parentStack[i];
|
|
26622
|
+
const child = parentStack[i + 1] || id;
|
|
26623
|
+
if (parent.type === "ObjectProperty" && parent.value === child) {
|
|
26624
|
+
if (parent.key.type === "StringLiteral") steps.push(`[${JSON.stringify(parent.key.value)}]`);
|
|
26625
|
+
else if (parent.computed) {
|
|
26541
26626
|
isDynamic = true;
|
|
26542
|
-
|
|
26543
|
-
} else
|
|
26544
|
-
}
|
|
26545
|
-
|
|
26546
|
-
|
|
26547
|
-
|
|
26548
|
-
|
|
26549
|
-
|
|
26627
|
+
steps.push(`[${rawValue.slice(parent.key.start - 1, parent.key.end - 1)}]`);
|
|
26628
|
+
} else steps.push(`.${parent.key.name}`);
|
|
26629
|
+
} else if (parent.type === "ArrayPattern") {
|
|
26630
|
+
const index = parent.elements.indexOf(child);
|
|
26631
|
+
if (child.type === "RestElement") steps.push(`.slice(${index})`);
|
|
26632
|
+
else steps.push(`[${index}]`);
|
|
26633
|
+
} else if (parent.type === "ObjectPattern" && child.type === "RestElement") {
|
|
26634
|
+
const helper = context.helper("getRestElement");
|
|
26635
|
+
const args = "[" + parent.properties.filter((p) => p.type === "ObjectProperty").map((p) => {
|
|
26636
|
+
if (p.key.type === "StringLiteral") return JSON.stringify(p.key.value);
|
|
26637
|
+
else if (p.computed) {
|
|
26638
|
+
isDynamic = true;
|
|
26639
|
+
return rawValue.slice(p.key.start - 1, p.key.end - 1);
|
|
26640
|
+
} else return JSON.stringify(p.key.name);
|
|
26641
|
+
}).join(", ") + "]";
|
|
26642
|
+
steps.push({
|
|
26643
|
+
helper,
|
|
26644
|
+
args
|
|
26645
|
+
});
|
|
26646
|
+
}
|
|
26647
|
+
if (child.type === "AssignmentPattern" && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern" || parent.type === "ArrowFunctionExpression")) {
|
|
26648
|
+
isDynamic = true;
|
|
26649
|
+
steps.push({
|
|
26650
|
+
helper: context.helper("getDefaultValue"),
|
|
26651
|
+
args: `() => (${rawValue.slice(child.right.start - 1, child.right.end - 1)})`
|
|
26652
|
+
});
|
|
26653
|
+
}
|
|
26550
26654
|
}
|
|
26655
|
+
map.set(id.name, {
|
|
26656
|
+
steps,
|
|
26657
|
+
dynamic: isDynamic
|
|
26658
|
+
});
|
|
26551
26659
|
}
|
|
26552
|
-
|
|
26553
|
-
|
|
26554
|
-
dynamic: isDynamic,
|
|
26555
|
-
helper,
|
|
26556
|
-
helperArgs
|
|
26557
|
-
});
|
|
26558
|
-
}
|
|
26559
|
-
}, true);
|
|
26560
|
-
else if (rawValue) map.set(rawValue, null);
|
|
26660
|
+
}, true);
|
|
26661
|
+
} else if (rawValue) map.set(rawValue, null);
|
|
26561
26662
|
}
|
|
26562
26663
|
return map;
|
|
26563
26664
|
}
|
|
@@ -26566,10 +26667,10 @@ function buildDestructureIdMap(idToPathMap, baseAccessor, plugins) {
|
|
|
26566
26667
|
idToPathMap.forEach((pathInfo, id) => {
|
|
26567
26668
|
let path = baseAccessor;
|
|
26568
26669
|
if (pathInfo) {
|
|
26569
|
-
|
|
26570
|
-
|
|
26571
|
-
idMap[
|
|
26572
|
-
path =
|
|
26670
|
+
for (const step of pathInfo.steps) if (typeof step === "string") path += step;
|
|
26671
|
+
else {
|
|
26672
|
+
idMap[step.helper] = null;
|
|
26673
|
+
path = `${step.helper}(${path}, ${step.args})`;
|
|
26573
26674
|
}
|
|
26574
26675
|
if (pathInfo.dynamic) {
|
|
26575
26676
|
const node = idMap[id] = createSimpleExpression(path);
|
|
@@ -26579,11 +26680,14 @@ function buildDestructureIdMap(idToPathMap, baseAccessor, plugins) {
|
|
|
26579
26680
|
});
|
|
26580
26681
|
return idMap;
|
|
26581
26682
|
}
|
|
26683
|
+
function isSelectValueEffect(effect) {
|
|
26684
|
+
return !!effect.once && effect.operations.some((oper) => oper.type === 5 || oper.type === 3 && oper.tag === "select" && oper.prop.key.content === "value");
|
|
26685
|
+
}
|
|
26582
26686
|
function matchPatterns(render, keyProp, idMap, context) {
|
|
26583
26687
|
const selectorPatterns = [];
|
|
26584
26688
|
const keyOnlyBindingPatterns = [];
|
|
26585
26689
|
let skippedEffectIndexes;
|
|
26586
|
-
if (keyProp === void 0) return {
|
|
26690
|
+
if (keyProp === void 0 || render.effect.some(isSelectValueEffect)) return {
|
|
26587
26691
|
keyOnlyBindingPatterns,
|
|
26588
26692
|
selectorPatterns,
|
|
26589
26693
|
skippedEffectIndexes
|
|
@@ -26780,7 +26884,8 @@ function genSetProp(oper, context) {
|
|
|
26780
26884
|
if (className) return className;
|
|
26781
26885
|
}
|
|
26782
26886
|
const propValue = genPropValue(values, context);
|
|
26783
|
-
|
|
26887
|
+
const call = genCall([helper(resolvedHelper.name), null], `n${oper.element}`, resolvedHelper.needKey ? genExpression(key, context) : false, propValue, resolvedHelper.isSVG && "true");
|
|
26888
|
+
return [NEWLINE, ...oper.once ? genOnce(call, context) : call];
|
|
26784
26889
|
}
|
|
26785
26890
|
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
26786
26891
|
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
@@ -26929,7 +27034,11 @@ function genDynamicProps$1(oper, context) {
|
|
|
26929
27034
|
const value = genExpression(props.value, context);
|
|
26930
27035
|
return props.handler ? genCall(helper("toHandlers"), value, "true") : value;
|
|
26931
27036
|
});
|
|
26932
|
-
|
|
27037
|
+
const call = genCall(helper("setDynamicProps"), `n${oper.element}`, genMulti(DELIMITERS_ARRAY, ...values), genDynamicPropNames$1(oper, context), oper.isSVG && "true");
|
|
27038
|
+
return [NEWLINE, ...oper.once ? genOnce(call, context) : call];
|
|
27039
|
+
}
|
|
27040
|
+
function genSyncSelectValue(oper, context) {
|
|
27041
|
+
return [NEWLINE, ...genCall(context.helper("syncSelectValue"), `n${oper.element}`, genDynamicPropNames$1(oper, context))];
|
|
26933
27042
|
}
|
|
26934
27043
|
function genDynamicPropNames$1(oper, context) {
|
|
26935
27044
|
const { bindingMetadata } = context.options;
|
|
@@ -26943,7 +27052,7 @@ function genDynamicPropNames$1(oper, context) {
|
|
|
26943
27052
|
function genLiteralObjectProps(props, context) {
|
|
26944
27053
|
const entries = [];
|
|
26945
27054
|
const listeners = createHandlerGroups(entries);
|
|
26946
|
-
for (const prop of props) if (isListenerProp(prop)) listeners.add(getStaticPropKeyName(prop, true), genPropKey(prop, context, true), prop.handler ? genEventHandler(context, prop.values, prop.handlerModifiers) : genPropValue(prop.values, context));
|
|
27055
|
+
for (const prop of props) if (isListenerProp(prop)) listeners.add(getStaticPropKeyName(prop, true), genPropKey(prop, context, true), prop.handler ? genEventHandler(context, prop.values, prop.handlerModifiers, { hoisted: prop }) : genPropValue(prop.values, context));
|
|
26947
27056
|
else entries.push([
|
|
26948
27057
|
...genPropKey(prop, context),
|
|
26949
27058
|
`: `,
|
|
@@ -27175,13 +27284,13 @@ function genCreateComponent(operation, context) {
|
|
|
27175
27284
|
return JSON.stringify(name);
|
|
27176
27285
|
} else if (operation.asset) return toValidAssetId(operation.tag, "component");
|
|
27177
27286
|
else {
|
|
27178
|
-
const { tag } = operation;
|
|
27287
|
+
const { tag, slotScopeNamespace } = operation;
|
|
27179
27288
|
const builtInTag = isBuiltInComponent(tag);
|
|
27180
27289
|
if (builtInTag) {
|
|
27181
27290
|
helper(builtInTag);
|
|
27182
27291
|
return `_${builtInTag}`;
|
|
27183
27292
|
}
|
|
27184
|
-
return genExpression(extend(createSimpleExpression(tag, false), { ast: null }), context);
|
|
27293
|
+
return [...genExpression(extend(createSimpleExpression(slotScopeNamespace || tag, false), { ast: null }), context), slotScopeNamespace && tag.slice(slotScopeNamespace.length)];
|
|
27185
27294
|
}
|
|
27186
27295
|
}
|
|
27187
27296
|
}
|
|
@@ -27210,13 +27319,6 @@ function genDynamicComponentFlags(root, once, slotRoot, ns) {
|
|
|
27210
27319
|
if (!flags) return false;
|
|
27211
27320
|
return genFlags(flags, names);
|
|
27212
27321
|
}
|
|
27213
|
-
function getUniqueHandlerName(context, name) {
|
|
27214
|
-
const { seenInlineHandlerNames } = context;
|
|
27215
|
-
name = genVarName(name);
|
|
27216
|
-
const count = seenInlineHandlerNames[name] || 0;
|
|
27217
|
-
seenInlineHandlerNames[name] = count + 1;
|
|
27218
|
-
return count === 0 ? name : `${name}${count}`;
|
|
27219
|
-
}
|
|
27220
27322
|
function processInlineHandlers(props, context) {
|
|
27221
27323
|
const ids = Object.create(null);
|
|
27222
27324
|
const handlers = [];
|
|
@@ -27588,7 +27690,6 @@ function genSlotFlags(flags) {
|
|
|
27588
27690
|
if (flags & 1) names.push("NO_SLOTTED");
|
|
27589
27691
|
if (flags & 2) names.push("ONCE");
|
|
27590
27692
|
if (flags & 4) names.push("FORWARDED");
|
|
27591
|
-
if (flags & 8) names.push("SHARED_FALLBACK");
|
|
27592
27693
|
return genFlags(flags, names);
|
|
27593
27694
|
}
|
|
27594
27695
|
//#endregion
|
|
@@ -27622,7 +27723,7 @@ function genBuiltinDirective(oper, context) {
|
|
|
27622
27723
|
*/
|
|
27623
27724
|
function genCustomDirectives(operations, context) {
|
|
27624
27725
|
const byElement = /* @__PURE__ */ new Map();
|
|
27625
|
-
for (const oper of operations) if (oper.type ===
|
|
27726
|
+
for (const oper of operations) if (oper.type === 14 && !oper.builtin) {
|
|
27626
27727
|
const dirs = byElement.get(oper.element);
|
|
27627
27728
|
if (dirs) dirs.push(oper);
|
|
27628
27729
|
else byElement.set(oper.element, [oper]);
|
|
@@ -27692,19 +27793,20 @@ function genOperation(oper, context) {
|
|
|
27692
27793
|
case 2: return genSetBlockKey(oper, context);
|
|
27693
27794
|
case 3: return genSetProp(oper, context);
|
|
27694
27795
|
case 4: return genDynamicProps$1(oper, context);
|
|
27695
|
-
case 5: return
|
|
27696
|
-
case 6: return
|
|
27697
|
-
case 7: return
|
|
27698
|
-
case 8: return
|
|
27699
|
-
case 9: return
|
|
27700
|
-
case 10: return
|
|
27701
|
-
case
|
|
27702
|
-
case 15: return
|
|
27703
|
-
case 16: return
|
|
27704
|
-
case
|
|
27705
|
-
case 12: return
|
|
27706
|
-
case 13: return
|
|
27707
|
-
case
|
|
27796
|
+
case 5: return genSyncSelectValue(oper, context);
|
|
27797
|
+
case 6: return genSetText(oper, context);
|
|
27798
|
+
case 7: return genSetEvent(oper, context);
|
|
27799
|
+
case 8: return genSetDynamicEvents(oper, context);
|
|
27800
|
+
case 9: return genSetHtml(oper, context);
|
|
27801
|
+
case 10: return genSetTemplateRef(oper, context);
|
|
27802
|
+
case 11: return genInsertNode(oper, context);
|
|
27803
|
+
case 15: return genIf(oper, context);
|
|
27804
|
+
case 16: return genFor(oper, context);
|
|
27805
|
+
case 17: return genKey(oper, context);
|
|
27806
|
+
case 12: return genCreateComponent(oper, context);
|
|
27807
|
+
case 13: return genSlotOutlet(oper, context);
|
|
27808
|
+
case 14: return genBuiltinDirective(oper, context);
|
|
27809
|
+
case 18: return genGetTextChild(oper, context);
|
|
27708
27810
|
default: throw new Error(`Unhandled operation type in genOperation: ${oper}`);
|
|
27709
27811
|
}
|
|
27710
27812
|
}
|
|
@@ -27732,8 +27834,9 @@ function genReactiveEffects(effects, context, genExtraFrag) {
|
|
|
27732
27834
|
if (shouldDeclare && !declarationFrags.length && !varNames.length) {
|
|
27733
27835
|
const effect = effects.length === 1 ? effects[0] : void 0;
|
|
27734
27836
|
const operation = effect && effect.operations.length === 1 ? effect.operations[0] : void 0;
|
|
27735
|
-
if (operation && operation.type ===
|
|
27837
|
+
if (operation && operation.type === 10 && operation.effect && !operation.refFor) return context.withExpressionReplacements(expressionReplacements, () => context.withId(() => genSetTemplateRefBinding(operation, context), ids));
|
|
27736
27838
|
}
|
|
27839
|
+
const handlerFrags = genHoistedHandlers(effects, context);
|
|
27737
27840
|
return context.withExpressionReplacements(expressionReplacements, () => {
|
|
27738
27841
|
push(...declarationFrags);
|
|
27739
27842
|
for (let i = 0; i < effects.length; i++) {
|
|
@@ -27755,6 +27858,7 @@ function genReactiveEffects(effects, context, genExtraFrag) {
|
|
|
27755
27858
|
}
|
|
27756
27859
|
if (!shouldDeclare && varNames.length) unshift(NEWLINE, `let `, varNames.join(", "));
|
|
27757
27860
|
if (genExtraFrag) push(...context.withId(genExtraFrag, ids));
|
|
27861
|
+
unshift(...handlerFrags);
|
|
27758
27862
|
return frag;
|
|
27759
27863
|
});
|
|
27760
27864
|
}
|
|
@@ -27786,7 +27890,7 @@ function genSelf(dynamic, context, flushBeforeDynamic) {
|
|
|
27786
27890
|
const [frag, push] = buildCodeFragment();
|
|
27787
27891
|
const { id, template, operation, hasDynamicChild } = dynamic;
|
|
27788
27892
|
if (id !== void 0 && template !== void 0) {
|
|
27789
|
-
if (operation && operation.type ===
|
|
27893
|
+
if (operation && operation.type === 11 && operation.appendIndex !== void 0) push(...genInsertionState(operation, context));
|
|
27790
27894
|
push(NEWLINE, `const n${id} = ${context.tName(template)}()`);
|
|
27791
27895
|
}
|
|
27792
27896
|
if (operation) push(...genOperationWithInsertionState(operation, context));
|
|
@@ -28028,49 +28132,37 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
|
|
|
28028
28132
|
}
|
|
28029
28133
|
}
|
|
28030
28134
|
function isVModelOperation(oper) {
|
|
28031
|
-
return oper.type ===
|
|
28135
|
+
return oper.type === 14 && oper.builtin === true && oper.name === "model";
|
|
28032
28136
|
}
|
|
28033
28137
|
function isVModelListener(oper, modelElements) {
|
|
28034
|
-
return (oper.type ===
|
|
28138
|
+
return (oper.type === 7 || oper.type === 8 || oper.type === 4 && oper.listeners || oper.type === 3 && !oper.prop.modifier && isOn(oper.prop.key.content)) && modelElements.has(oper.element);
|
|
28035
28139
|
}
|
|
28036
|
-
function markSlotRootOperations(block, context
|
|
28140
|
+
function markSlotRootOperations(block, context) {
|
|
28037
28141
|
if (hasStableSlotRoot(block, context)) return;
|
|
28038
|
-
sharedFallback = sharedFallback || hasMultipleDynamicSlotRoots(block);
|
|
28039
28142
|
for (let i = 0; i < block.returns.length; i++) {
|
|
28040
28143
|
const child = findReturnedDynamic$1(block, block.returns[i]);
|
|
28041
28144
|
const operation = child && child.operation;
|
|
28042
28145
|
if (!operation) continue;
|
|
28043
|
-
if (operation.type ===
|
|
28044
|
-
else if (operation.type ===
|
|
28045
|
-
else if (operation.type ===
|
|
28146
|
+
if (operation.type === 15) markSlotRootIf(operation, context);
|
|
28147
|
+
else if (operation.type === 16) markSlotRootFor(operation, context);
|
|
28148
|
+
else if (operation.type === 17) {
|
|
28046
28149
|
operation.slotRoot = true;
|
|
28047
|
-
markSlotRootOperations(operation.block, context
|
|
28048
|
-
} else if (operation.type ===
|
|
28049
|
-
else if (operation.type ===
|
|
28050
|
-
operation.flags |= 4;
|
|
28051
|
-
if (sharedFallback) operation.flags |= 8;
|
|
28052
|
-
}
|
|
28150
|
+
markSlotRootOperations(operation.block, context);
|
|
28151
|
+
} else if (operation.type === 12) markSlotRootComponent(operation);
|
|
28152
|
+
else if (operation.type === 13) operation.flags |= 4;
|
|
28053
28153
|
}
|
|
28054
28154
|
}
|
|
28055
|
-
function markSlotRootIf(operation, context
|
|
28155
|
+
function markSlotRootIf(operation, context) {
|
|
28056
28156
|
if (!operation.once) operation.slotRoot = true;
|
|
28057
|
-
markSlotRootOperations(operation.positive, context
|
|
28157
|
+
markSlotRootOperations(operation.positive, context);
|
|
28058
28158
|
const negative = operation.negative;
|
|
28059
28159
|
if (!negative) return;
|
|
28060
|
-
if (negative.type ===
|
|
28061
|
-
else markSlotRootOperations(negative, context
|
|
28160
|
+
if (negative.type === 15) markSlotRootIf(negative, context);
|
|
28161
|
+
else markSlotRootOperations(negative, context);
|
|
28062
28162
|
}
|
|
28063
28163
|
function markSlotRootFor(operation, context) {
|
|
28064
28164
|
if (!operation.once) operation.slotRoot = true;
|
|
28065
|
-
markSlotRootOperations(operation.render, context
|
|
28066
|
-
}
|
|
28067
|
-
function hasMultipleDynamicSlotRoots(block) {
|
|
28068
|
-
let count = 0;
|
|
28069
|
-
for (let i = 0; i < block.returns.length; i++) {
|
|
28070
|
-
const child = findReturnedDynamic$1(block, block.returns[i]);
|
|
28071
|
-
if (child && child.operation && ++count > 1) return true;
|
|
28072
|
-
}
|
|
28073
|
-
return false;
|
|
28165
|
+
markSlotRootOperations(operation.render, context);
|
|
28074
28166
|
}
|
|
28075
28167
|
function markSlotRootComponent(operation) {
|
|
28076
28168
|
if (!operation.once && operation.dynamic && !operation.dynamic.isStatic) operation.slotRoot = true;
|
|
@@ -28093,13 +28185,13 @@ function hasStableSlotRoot(block, context) {
|
|
|
28093
28185
|
continue;
|
|
28094
28186
|
}
|
|
28095
28187
|
switch (operation.type) {
|
|
28096
|
-
case
|
|
28188
|
+
case 12:
|
|
28097
28189
|
if (!operation.dynamic || operation.dynamic.isStatic) {
|
|
28098
28190
|
hasValidRoot = true;
|
|
28099
28191
|
continue;
|
|
28100
28192
|
}
|
|
28101
28193
|
continue;
|
|
28102
|
-
case
|
|
28194
|
+
case 17:
|
|
28103
28195
|
if (hasStableSlotRoot(operation.block, context)) {
|
|
28104
28196
|
hasValidRoot = true;
|
|
28105
28197
|
continue;
|
|
@@ -28134,7 +28226,7 @@ function collectSingleUseAssetComponents(block) {
|
|
|
28134
28226
|
function visitOperation(operation, rootCandidate) {
|
|
28135
28227
|
if (seenOperations.has(operation)) return;
|
|
28136
28228
|
seenOperations.add(operation);
|
|
28137
|
-
if (operation.type ===
|
|
28229
|
+
if (operation.type === 12) {
|
|
28138
28230
|
if (operation.asset) {
|
|
28139
28231
|
const usage = usageMap.get(operation.tag) || {
|
|
28140
28232
|
count: 0,
|
|
@@ -28148,20 +28240,20 @@ function collectSingleUseAssetComponents(block) {
|
|
|
28148
28240
|
return;
|
|
28149
28241
|
}
|
|
28150
28242
|
switch (operation.type) {
|
|
28151
|
-
case
|
|
28243
|
+
case 15:
|
|
28152
28244
|
visitBlock(operation.positive, false);
|
|
28153
28245
|
if (operation.negative) {
|
|
28154
|
-
if (operation.negative.type ===
|
|
28246
|
+
if (operation.negative.type === 15) visitOperation(operation.negative, false);
|
|
28155
28247
|
else visitBlock(operation.negative, false);
|
|
28156
28248
|
}
|
|
28157
28249
|
break;
|
|
28158
|
-
case
|
|
28250
|
+
case 16:
|
|
28159
28251
|
visitBlock(operation.render, false);
|
|
28160
28252
|
break;
|
|
28161
|
-
case
|
|
28253
|
+
case 17:
|
|
28162
28254
|
visitBlock(operation.block, false);
|
|
28163
28255
|
break;
|
|
28164
|
-
case
|
|
28256
|
+
case 13: if (operation.fallback) visitBlock(operation.fallback, false);
|
|
28165
28257
|
}
|
|
28166
28258
|
}
|
|
28167
28259
|
function visitSlots(slots) {
|
|
@@ -28235,6 +28327,7 @@ var CodegenContext = class {
|
|
|
28235
28327
|
}
|
|
28236
28328
|
isNameAvailable(name, reservedNames) {
|
|
28237
28329
|
var _this$identifiers$nam;
|
|
28330
|
+
if (name === "_ctx" || name === setTemplateRefIdent) return false;
|
|
28238
28331
|
if (this.bindingNames.has(name) || reservedNames.has(name)) return false;
|
|
28239
28332
|
if ((_this$identifiers$nam = this.identifiers[name]) === null || _this$identifiers$nam === void 0 ? void 0 : _this$identifiers$nam.length) return false;
|
|
28240
28333
|
for (const alias of this.helpers.values()) if (alias === name) return false;
|
|
@@ -28304,7 +28397,6 @@ var CodegenContext = class {
|
|
|
28304
28397
|
this.dynamicPropNames = /* @__PURE__ */ new Map();
|
|
28305
28398
|
this.identifiers = Object.create(null);
|
|
28306
28399
|
this.expressionReplacements = [];
|
|
28307
|
-
this.seenInlineHandlerNames = Object.create(null);
|
|
28308
28400
|
this.scopeLevel = 0;
|
|
28309
28401
|
this.templateVars = /* @__PURE__ */ new Map();
|
|
28310
28402
|
this.nextIdMap = /* @__PURE__ */ new Map();
|
|
@@ -28449,7 +28541,7 @@ const transformKey = (node, context) => {
|
|
|
28449
28541
|
return () => {
|
|
28450
28542
|
exitBlock();
|
|
28451
28543
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
28452
|
-
type:
|
|
28544
|
+
type: 17,
|
|
28453
28545
|
id
|
|
28454
28546
|
}, context.effectBoundary()), {}, {
|
|
28455
28547
|
value,
|
|
@@ -28479,7 +28571,7 @@ const transformVHtml = (dir, node, context) => {
|
|
|
28479
28571
|
value: exp
|
|
28480
28572
|
};
|
|
28481
28573
|
context.registerEffect([exp], {
|
|
28482
|
-
type:
|
|
28574
|
+
type: 9,
|
|
28483
28575
|
element: context.reference(),
|
|
28484
28576
|
value: exp
|
|
28485
28577
|
});
|
|
@@ -28544,7 +28636,7 @@ const transformElement = (node, context) => {
|
|
|
28544
28636
|
const getEffectIndex = () => effectIndex++;
|
|
28545
28637
|
if (node.type === 1 && node.children.length) ignoreVHtmlChildren(node, context, "node");
|
|
28546
28638
|
let parentSlots;
|
|
28547
|
-
if (node.type === 1 && (node.tagType === 1 ||
|
|
28639
|
+
if (node.type === 1 && (node.tagType === 1 || shouldUseCreateElement(node, context))) {
|
|
28548
28640
|
parentSlots = context.slots;
|
|
28549
28641
|
context.slots = [];
|
|
28550
28642
|
}
|
|
@@ -28599,12 +28691,13 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
28599
28691
|
const dynamicComponent = isDynamicComponent ? resolveDynamicComponent(node) : void 0;
|
|
28600
28692
|
let { tag } = node;
|
|
28601
28693
|
let asset = true;
|
|
28694
|
+
let slotScopeNamespace;
|
|
28602
28695
|
if (!dynamicComponent && !useCreateElement) {
|
|
28603
28696
|
const isProp = findProp(node, "is");
|
|
28604
28697
|
if (isProp && isProp.type === 6 && isVueIsValue(isProp)) tag = isProp.value.content.slice(4);
|
|
28605
|
-
const
|
|
28606
|
-
if (
|
|
28607
|
-
tag =
|
|
28698
|
+
const resolved = resolveSlotScopeReference(tag, context) || resolveSetupReference(tag, context);
|
|
28699
|
+
if (resolved) {
|
|
28700
|
+
tag = resolved;
|
|
28608
28701
|
asset = false;
|
|
28609
28702
|
}
|
|
28610
28703
|
const builtInTag = isBuiltInComponent(tag);
|
|
@@ -28614,7 +28707,8 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
28614
28707
|
}
|
|
28615
28708
|
const dotIndex = tag.indexOf(".");
|
|
28616
28709
|
if (dotIndex > 0) {
|
|
28617
|
-
|
|
28710
|
+
slotScopeNamespace = resolveSlotScopeReference(tag.slice(0, dotIndex), context);
|
|
28711
|
+
const ns = slotScopeNamespace || resolveSetupReference(tag.slice(0, dotIndex), context);
|
|
28618
28712
|
if (ns) {
|
|
28619
28713
|
tag = ns + tag.slice(dotIndex);
|
|
28620
28714
|
asset = false;
|
|
@@ -28637,10 +28731,11 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
28637
28731
|
context.dynamic.flags |= 6;
|
|
28638
28732
|
const id = context.reference();
|
|
28639
28733
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
28640
|
-
type:
|
|
28734
|
+
type: 12,
|
|
28641
28735
|
id
|
|
28642
28736
|
}, context.effectBoundary()), {}, {
|
|
28643
28737
|
tag,
|
|
28738
|
+
slotScopeNamespace,
|
|
28644
28739
|
props,
|
|
28645
28740
|
asset,
|
|
28646
28741
|
root: singleRoot,
|
|
@@ -28663,12 +28758,45 @@ function resolveDynamicComponent(node) {
|
|
|
28663
28758
|
if (isProp.type === 6) return isProp.value && createSimpleExpression(isProp.value.content, true);
|
|
28664
28759
|
else return isProp.exp || extend(createSimpleExpression(`is`, false, isProp.arg.loc), { ast: null });
|
|
28665
28760
|
}
|
|
28761
|
+
function resolveSlotScopeReference(name, context) {
|
|
28762
|
+
const camelName = camelize(name);
|
|
28763
|
+
for (const reference of [
|
|
28764
|
+
name,
|
|
28765
|
+
camelName,
|
|
28766
|
+
capitalize(camelName)
|
|
28767
|
+
]) {
|
|
28768
|
+
let parent = context.parent;
|
|
28769
|
+
while (parent) {
|
|
28770
|
+
const { node } = parent;
|
|
28771
|
+
if (node.type === 1) {
|
|
28772
|
+
const slot = findDir(node, "slot");
|
|
28773
|
+
if (slot && hasScopeBinding(reference, slot.exp)) return reference;
|
|
28774
|
+
const vFor = findDir(node, "for");
|
|
28775
|
+
const aliases = vFor && vFor.forParseResult;
|
|
28776
|
+
if (aliases && [
|
|
28777
|
+
aliases.value,
|
|
28778
|
+
aliases.key,
|
|
28779
|
+
aliases.index
|
|
28780
|
+
].some((exp) => hasScopeBinding(reference, exp))) break;
|
|
28781
|
+
}
|
|
28782
|
+
parent = parent.parent;
|
|
28783
|
+
}
|
|
28784
|
+
}
|
|
28785
|
+
}
|
|
28786
|
+
function hasScopeBinding(name, exp) {
|
|
28787
|
+
return exp && (exp.ast ? exp.ast.params.some((param) => extractIdentifiers(param).some((id) => id.name === name)) : exp.content === name);
|
|
28788
|
+
}
|
|
28666
28789
|
function resolveSetupReference(name, context) {
|
|
28667
28790
|
const bindings = context.options.bindingMetadata;
|
|
28668
28791
|
if (!bindings || bindings.__isScriptSetup === false) return;
|
|
28669
28792
|
const camelName = camelize(name);
|
|
28670
28793
|
const PascalName = capitalize(camelName);
|
|
28671
|
-
|
|
28794
|
+
const checkType = (type) => {
|
|
28795
|
+
if (bindings[name] === type) return name;
|
|
28796
|
+
if (bindings[camelName] === type) return camelName;
|
|
28797
|
+
if (bindings[PascalName] === type) return PascalName;
|
|
28798
|
+
};
|
|
28799
|
+
return checkType("setup-const") || checkType("setup-reactive-const") || checkType("literal-const") || checkType("setup-let") || checkType("setup-ref") || checkType("setup-maybe-ref") || checkType("props");
|
|
28672
28800
|
}
|
|
28673
28801
|
const dynamicKeys = [
|
|
28674
28802
|
"indeterminate",
|
|
@@ -28678,6 +28806,12 @@ const dynamicKeys = [
|
|
|
28678
28806
|
"currentTime",
|
|
28679
28807
|
"valueAsNumber"
|
|
28680
28808
|
];
|
|
28809
|
+
const inputValueDepKeys = [
|
|
28810
|
+
"type",
|
|
28811
|
+
"min",
|
|
28812
|
+
"max",
|
|
28813
|
+
"step"
|
|
28814
|
+
];
|
|
28681
28815
|
const NEEDS_QUOTES_RE = /[\s"'`=<>]/;
|
|
28682
28816
|
const LEADING_NEWLINE_RE = /^\r?\n/;
|
|
28683
28817
|
const UNSAFE_ATTR_NAME_RE = /[\u0000-\u0020"'<=/>]/;
|
|
@@ -28685,6 +28819,8 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
28685
28819
|
const { tag } = node;
|
|
28686
28820
|
const { scopeId } = context.options;
|
|
28687
28821
|
const isSVG = node.ns === 1;
|
|
28822
|
+
const isSelect = tag === "select";
|
|
28823
|
+
const hasDynamicKeys = isSelect && node.props.some((prop) => prop.type === 7 && (prop.name === "bind" || prop.name === "on") && (!prop.arg || !isStaticExp(prop.arg)));
|
|
28688
28824
|
let template = "";
|
|
28689
28825
|
template += `<${tag}`;
|
|
28690
28826
|
if (scopeId) template += ` ${scopeId}`;
|
|
@@ -28694,8 +28830,14 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
28694
28830
|
type: 4,
|
|
28695
28831
|
element: context.reference(),
|
|
28696
28832
|
props: dynamicArgs,
|
|
28697
|
-
isSVG
|
|
28833
|
+
isSVG,
|
|
28834
|
+
once: isSelect && context.inVOnce
|
|
28698
28835
|
}, getEffectIndex);
|
|
28836
|
+
if (isSelect && !context.inVOnce) context.registerEffect([], {
|
|
28837
|
+
type: 5,
|
|
28838
|
+
element: context.reference(),
|
|
28839
|
+
props: dynamicArgs
|
|
28840
|
+
}, void 0, true);
|
|
28699
28841
|
} else {
|
|
28700
28842
|
const appendTemplateProp = (key, value = "") => {
|
|
28701
28843
|
template += ` ${key}`;
|
|
@@ -28706,8 +28848,12 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
28706
28848
|
};
|
|
28707
28849
|
const needsOrderedProps = tag === "input" && propsResult[1].some(({ key, modifier }) => key.content === "valueAsNumber" && modifier !== "^");
|
|
28708
28850
|
const nativeOnProps = [];
|
|
28851
|
+
let props = propsResult[1];
|
|
28852
|
+
const valueProp = props.find(({ key, modifier }) => key.isStatic && key.content === "value" && (!modifier || isSelect && modifier === "."));
|
|
28853
|
+
if (valueProp) props = [...props.filter((p) => p !== valueProp), valueProp];
|
|
28709
28854
|
let hasEffect = false;
|
|
28710
|
-
|
|
28855
|
+
let hasValueDep = false;
|
|
28856
|
+
for (const prop of props) {
|
|
28711
28857
|
const { key, values } = prop;
|
|
28712
28858
|
const canStringifyAttrName = key.isStatic && !UNSAFE_ATTR_NAME_RE.test(key.content);
|
|
28713
28859
|
let foldedValue;
|
|
@@ -28720,25 +28866,30 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
28720
28866
|
tag,
|
|
28721
28867
|
isSVG
|
|
28722
28868
|
};
|
|
28723
|
-
|
|
28724
|
-
operation.effect
|
|
28869
|
+
operation.effect = context.registerEffect(values, operation, getEffectIndex, needsOrderedProps && hasEffect);
|
|
28870
|
+
hasEffect = operation.effect || hasEffect;
|
|
28725
28871
|
}
|
|
28726
28872
|
} else if (canStringifyAttrName && context.imports.some((imported) => values[0].content.includes(imported.exp.content))) template += ` ${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
|
|
28727
|
-
else if (canStringifyAttrName && prop.modifier !== "." && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content) && !isRuntimeOnlyProp(node, key.content)) {
|
|
28873
|
+
else if (canStringifyAttrName && prop.modifier !== "." && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content) && !isRuntimeOnlyProp(node, key.content) && !(prop === valueProp && hasValueDep)) {
|
|
28728
28874
|
const value = values[0].content === "''" ? "" : values[0].content;
|
|
28729
28875
|
appendTemplateProp(key.content, value);
|
|
28730
28876
|
} else if (canStringifyAttrName && !prop.modifier && isFoldableBooleanAttr(key.content) && (foldedValue = foldBooleanAttrValue(key.content, values)) != null) {
|
|
28731
28877
|
if (foldedValue) appendTemplateProp(key.content);
|
|
28732
28878
|
} else if (canStringifyAttrName && !prop.modifier && hasBoundValue(values) && (foldedValue = key.content === "class" ? foldClassValues(values) : key.content === "style" ? foldStyleValues(values) : void 0) != null) {
|
|
28733
28879
|
if (foldedValue) appendTemplateProp(key.content, foldedValue);
|
|
28734
|
-
} else if (
|
|
28735
|
-
else
|
|
28736
|
-
|
|
28737
|
-
|
|
28738
|
-
|
|
28739
|
-
|
|
28740
|
-
|
|
28741
|
-
|
|
28880
|
+
} else if (!prop.modifier && isNativeOn(key.content)) nativeOnProps.push(prop);
|
|
28881
|
+
else {
|
|
28882
|
+
const isSelectValue = isSelect && prop === valueProp;
|
|
28883
|
+
hasEffect = context.registerEffect(values, {
|
|
28884
|
+
type: 3,
|
|
28885
|
+
element: context.reference(),
|
|
28886
|
+
prop,
|
|
28887
|
+
tag,
|
|
28888
|
+
isSVG,
|
|
28889
|
+
once: isSelectValue && (context.inVOnce || !hasDynamicKeys && values.every((exp) => isConstantBinding$1(exp, context.options.bindingMetadata)))
|
|
28890
|
+
}, isSelectValue ? void 0 : getEffectIndex, isSelectValue || (needsOrderedProps || tag === "input" && prop === valueProp) && hasEffect) || hasEffect;
|
|
28891
|
+
if (tag === "input" && inputValueDepKeys.includes(key.content)) hasValueDep = true;
|
|
28892
|
+
}
|
|
28742
28893
|
}
|
|
28743
28894
|
if (nativeOnProps.length) context.registerEffect(nativeOnProps.flatMap(({ values }) => values), {
|
|
28744
28895
|
type: 4,
|
|
@@ -28914,7 +29065,16 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
28914
29065
|
const dynamicArgs = [];
|
|
28915
29066
|
const dynamicExpr = [];
|
|
28916
29067
|
let results = [];
|
|
28917
|
-
|
|
29068
|
+
let resolvedBind;
|
|
29069
|
+
let resolvedBindProps;
|
|
29070
|
+
const deferListeners = !isComponent && !!findDir(node, "model") && props.some((prop) => prop.type === 7 && prop.name === "on" && !prop.arg) && mergesListeners(node, context) && props.every((prop) => {
|
|
29071
|
+
if (prop.type !== 7 || prop.name !== "bind") return true;
|
|
29072
|
+
if (prop.arg) return prop.arg.type === 4 && prop.arg.isStatic;
|
|
29073
|
+
if (!prop.exp) return false;
|
|
29074
|
+
resolvedBind = prop;
|
|
29075
|
+
resolvedBindProps = resolveNativeObjectLiteralBindProps(prop.exp, context, props, prop);
|
|
29076
|
+
return !!resolvedBindProps;
|
|
29077
|
+
});
|
|
28918
29078
|
let listenerResults = [];
|
|
28919
29079
|
function pushMergeArg(listeners = false) {
|
|
28920
29080
|
const props = listeners ? listenerResults : results;
|
|
@@ -28934,12 +29094,16 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
28934
29094
|
if (prop.type === 7 && !prop.arg) {
|
|
28935
29095
|
if (prop.name === "bind") {
|
|
28936
29096
|
if (prop.exp) {
|
|
28937
|
-
const objectLiteralProps = isComponent ? resolveComponentObjectLiteralBindProps(prop.exp, context, props, prop) : resolveNativeObjectLiteralBindProps(prop.exp, context, props, prop);
|
|
29097
|
+
const objectLiteralProps = isComponent ? resolveComponentObjectLiteralBindProps(prop.exp, context, props, prop) : prop === resolvedBind ? resolvedBindProps : resolveNativeObjectLiteralBindProps(prop.exp, context, props, prop);
|
|
28938
29098
|
if (objectLiteralProps) {
|
|
28939
29099
|
if (isComponent) pushStaticObjectLiteralProps(objectLiteralProps);
|
|
28940
29100
|
else {
|
|
28941
29101
|
dynamicExpr.push(prop.exp);
|
|
28942
|
-
|
|
29102
|
+
for (const boundProp of objectLiteralProps) {
|
|
29103
|
+
const result = toDirectiveResult(boundProp);
|
|
29104
|
+
if (deferListeners && isNativeOn(boundProp.key.content)) listenerResults.push(result);
|
|
29105
|
+
else results.push(result);
|
|
29106
|
+
}
|
|
28943
29107
|
}
|
|
28944
29108
|
} else {
|
|
28945
29109
|
dynamicExpr.push(prop.exp);
|
|
@@ -28964,7 +29128,7 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
28964
29128
|
handler: true
|
|
28965
29129
|
});
|
|
28966
29130
|
} else context.registerEffect([prop.exp], {
|
|
28967
|
-
type:
|
|
29131
|
+
type: 8,
|
|
28968
29132
|
element: context.reference(),
|
|
28969
29133
|
event: prop.exp
|
|
28970
29134
|
}, getEffectIndex);
|
|
@@ -28975,12 +29139,12 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
28975
29139
|
if (prop.type === 6 ? prop.name === "is" && (isDynamicComponent || isVueIsValue(prop)) : isDynamicComponent && prop.name === "bind" && isStaticArgOf(prop.arg, "is")) continue;
|
|
28976
29140
|
const result = transformProp(prop, node, context);
|
|
28977
29141
|
if (result) {
|
|
28978
|
-
if (deferListeners && !result.handler && (result.modifier || !isOn(result.key.content))) {
|
|
29142
|
+
if (deferListeners && !result.handler && (result.modifier || !isOn(result.key.content) && !isNativeOn(result.key.content))) {
|
|
28979
29143
|
results.push(result);
|
|
28980
29144
|
continue;
|
|
28981
29145
|
}
|
|
28982
29146
|
dynamicExpr.push(result.key);
|
|
28983
|
-
if (!
|
|
29147
|
+
if (!result.handler) dynamicExpr.push(result.value);
|
|
28984
29148
|
if (deferListeners) listenerResults.push(result);
|
|
28985
29149
|
else if (isComponent && !result.key.isStatic) {
|
|
28986
29150
|
pushMergeArg();
|
|
@@ -29052,10 +29216,10 @@ function resolveListenerMerge(node, context) {
|
|
|
29052
29216
|
if (p.exp) {
|
|
29053
29217
|
const bindProps = resolveNativeObjectLiteralBindProps(p.exp, context, props, p);
|
|
29054
29218
|
if (!bindProps) return true;
|
|
29055
|
-
if (
|
|
29219
|
+
if (bindProps.some(({ key }) => isNativeOn(key.content))) hasStaticListener = true;
|
|
29056
29220
|
}
|
|
29057
29221
|
} else if (!arg.isStatic) return true;
|
|
29058
|
-
else if ((isOn(arg.content) ||
|
|
29222
|
+
else if ((isOn(arg.content) || isNativeOn(arg.content)) && !isModelListener(arg.content) && !p.modifiers.some((m) => m.content === "prop" || m.content === "attr")) hasStaticListener = true;
|
|
29059
29223
|
} else if (p.name === "on") {
|
|
29060
29224
|
if (!arg) hasVOnObject = true;
|
|
29061
29225
|
else if (arg.isStatic && !p.modifiers.some((m) => m.content === "delegate")) hasStaticListener = true;
|
|
@@ -29183,13 +29347,19 @@ function createObjectBindSubExpression(source, node, context) {
|
|
|
29183
29347
|
expression.ast = isSimpleIdentifier(content) ? null : (0, import_lib.parseExpression)(`(${content})`, getParserOptions(context.options.expressionPlugins));
|
|
29184
29348
|
return expression;
|
|
29185
29349
|
}
|
|
29350
|
+
function createStaticStyleExpression(value, context) {
|
|
29351
|
+
const content = JSON.stringify(parseStringStyle(value.content));
|
|
29352
|
+
const expression = createSimpleExpression(content, false, value.loc);
|
|
29353
|
+
expression.ast = (0, import_lib.parseExpression)(`(${content})`, getParserOptions(context.options.expressionPlugins));
|
|
29354
|
+
return expression;
|
|
29355
|
+
}
|
|
29186
29356
|
function transformProp(prop, node, context) {
|
|
29187
29357
|
let { name } = prop;
|
|
29188
29358
|
if (prop.type === 6) {
|
|
29189
29359
|
if (isReservedProp(name)) return;
|
|
29190
29360
|
return {
|
|
29191
29361
|
key: createSimpleExpression(prop.name, true, prop.nameLoc),
|
|
29192
|
-
value: prop.value ? createSimpleExpression(prop.value.content, true, prop.value.loc) : EMPTY_EXPRESSION
|
|
29362
|
+
value: prop.value ? name === "style" && node.tagType === 1 ? createStaticStyleExpression(prop.value, context) : createSimpleExpression(prop.value.content, true, prop.value.loc) : EMPTY_EXPRESSION
|
|
29193
29363
|
};
|
|
29194
29364
|
}
|
|
29195
29365
|
const directiveTransform = context.options.directiveTransforms[name];
|
|
@@ -29203,7 +29373,7 @@ function transformProp(prop, node, context) {
|
|
|
29203
29373
|
if (fromSetup) name = fromSetup;
|
|
29204
29374
|
else context.directive.add(name);
|
|
29205
29375
|
context.registerOperation({
|
|
29206
|
-
type:
|
|
29376
|
+
type: 14,
|
|
29207
29377
|
element: context.reference(),
|
|
29208
29378
|
dir: prop,
|
|
29209
29379
|
name,
|
|
@@ -29300,7 +29470,7 @@ function processDynamicChildren(context, useCreateElement) {
|
|
|
29300
29470
|
anchor = child.anchor = context.increaseId();
|
|
29301
29471
|
}
|
|
29302
29472
|
if (child.template != null) child.operation = {
|
|
29303
|
-
type:
|
|
29473
|
+
type: 11,
|
|
29304
29474
|
elements: [child.id],
|
|
29305
29475
|
parent: context.reference(),
|
|
29306
29476
|
anchor,
|
|
@@ -29320,6 +29490,35 @@ const transformVOnce = (node, context) => {
|
|
|
29320
29490
|
if (node.type === 1 && findDir$1(node, "once", true)) context.inVOnce = true;
|
|
29321
29491
|
};
|
|
29322
29492
|
//#endregion
|
|
29493
|
+
//#region packages/compiler-vapor/src/transforms/transformComment.ts
|
|
29494
|
+
const ignoredComments = /* @__PURE__ */ new WeakMap();
|
|
29495
|
+
function ignoreComment(node, context) {
|
|
29496
|
+
let ignored = ignoredComments.get(context.root);
|
|
29497
|
+
if (!ignored) ignoredComments.set(context.root, ignored = /* @__PURE__ */ new WeakSet());
|
|
29498
|
+
ignored.add(node);
|
|
29499
|
+
}
|
|
29500
|
+
const transformComment = (node, context) => {
|
|
29501
|
+
var _ignoredComments$get;
|
|
29502
|
+
if (node.type !== 3) return;
|
|
29503
|
+
if ((_ignoredComments$get = ignoredComments.get(context.root)) === null || _ignoredComments$get === void 0 ? void 0 : _ignoredComments$get.has(node)) context.dynamic.flags |= 2;
|
|
29504
|
+
else if (getSiblingIf(context)) {
|
|
29505
|
+
context.comment.push(node);
|
|
29506
|
+
context.dynamic.flags |= 2;
|
|
29507
|
+
} else context.template += `<!--${node.content}-->`;
|
|
29508
|
+
};
|
|
29509
|
+
function getSiblingIf(context, reverse) {
|
|
29510
|
+
const parent = context.parent;
|
|
29511
|
+
if (!parent) return;
|
|
29512
|
+
const siblings = parent.node.children;
|
|
29513
|
+
let sibling;
|
|
29514
|
+
let i = siblings.indexOf(context.node);
|
|
29515
|
+
while (reverse ? --i >= 0 : ++i < siblings.length) {
|
|
29516
|
+
sibling = siblings[i];
|
|
29517
|
+
if (!isCommentOrWhitespace(sibling)) break;
|
|
29518
|
+
}
|
|
29519
|
+
if (sibling && sibling.type === 1 && !(sibling.tagType === 3 && sibling.props.some(isVSlot)) && sibling.props.some(({ type, name }) => type === 7 && ["else-if", reverse ? "if" : "else"].includes(name))) return sibling;
|
|
29520
|
+
}
|
|
29521
|
+
//#endregion
|
|
29323
29522
|
//#region packages/compiler-vapor/src/transforms/transformText.ts
|
|
29324
29523
|
const seen = /* @__PURE__ */ new WeakMap();
|
|
29325
29524
|
function markNonTemplate(node, context) {
|
|
@@ -29354,6 +29553,10 @@ const transformText = (node, context) => {
|
|
|
29354
29553
|
} else if (node.type === 5) processInterpolation(context);
|
|
29355
29554
|
else if (node.type === 2) {
|
|
29356
29555
|
var _context$parent;
|
|
29556
|
+
if (!node.content.trim() && getSiblingIf(context)) {
|
|
29557
|
+
context.dynamic.flags |= 2;
|
|
29558
|
+
return;
|
|
29559
|
+
}
|
|
29357
29560
|
const parent = (_context$parent = context.parent) === null || _context$parent === void 0 ? void 0 : _context$parent.node;
|
|
29358
29561
|
const createElementParent = parent && parent.type === 1 && shouldUseCreateElement(parent, context.parent);
|
|
29359
29562
|
const isRootText = !parent || parent.type === 0 || parent.type === 1 && (parent.tagType === 3 || parent.tagType === 1);
|
|
@@ -29386,7 +29589,7 @@ function processInterpolation(context) {
|
|
|
29386
29589
|
context.dynamic.isText = isElementChild;
|
|
29387
29590
|
if (values.length === 0) return;
|
|
29388
29591
|
context.registerEffect(values, {
|
|
29389
|
-
type:
|
|
29592
|
+
type: 6,
|
|
29390
29593
|
element: id,
|
|
29391
29594
|
values
|
|
29392
29595
|
});
|
|
@@ -29410,11 +29613,11 @@ function processTextContainer(children, context) {
|
|
|
29410
29613
|
else {
|
|
29411
29614
|
context.childrenTemplate = [" "];
|
|
29412
29615
|
context.registerOperation({
|
|
29413
|
-
type:
|
|
29616
|
+
type: 18,
|
|
29414
29617
|
parent: context.reference()
|
|
29415
29618
|
});
|
|
29416
29619
|
context.registerEffect(values, {
|
|
29417
|
-
type:
|
|
29620
|
+
type: 6,
|
|
29418
29621
|
element: context.reference(),
|
|
29419
29622
|
values,
|
|
29420
29623
|
generated: true
|
|
@@ -29431,7 +29634,7 @@ function registerSyntheticTextChild(context, template, values) {
|
|
|
29431
29634
|
};
|
|
29432
29635
|
context.dynamic.hasDynamicChild = true;
|
|
29433
29636
|
if (values && values.length) context.registerEffect(values, {
|
|
29434
|
-
type:
|
|
29637
|
+
type: 6,
|
|
29435
29638
|
element: id,
|
|
29436
29639
|
values
|
|
29437
29640
|
});
|
|
@@ -29445,7 +29648,7 @@ function materializeLiteralTextNode(value, context) {
|
|
|
29445
29648
|
context.dynamic.flags |= 6;
|
|
29446
29649
|
context.dynamic.template = context.pushTemplate("");
|
|
29447
29650
|
context.registerEffect([value], {
|
|
29448
|
-
type:
|
|
29651
|
+
type: 6,
|
|
29449
29652
|
element: id,
|
|
29450
29653
|
values: [value]
|
|
29451
29654
|
});
|
|
@@ -29490,7 +29693,7 @@ const transformVText = (dir, node, context) => {
|
|
|
29490
29693
|
if (useCreateElement || isRawTextContainer(node.tag)) {
|
|
29491
29694
|
const id = registerSyntheticTextChild(context, "", [exp]);
|
|
29492
29695
|
context.registerOperation({
|
|
29493
|
-
type:
|
|
29696
|
+
type: 11,
|
|
29494
29697
|
elements: [id],
|
|
29495
29698
|
parent: context.reference()
|
|
29496
29699
|
});
|
|
@@ -29500,19 +29703,19 @@ const transformVText = (dir, node, context) => {
|
|
|
29500
29703
|
if (useCreateElement) {
|
|
29501
29704
|
id = registerSyntheticTextChild(context, "");
|
|
29502
29705
|
context.registerOperation({
|
|
29503
|
-
type:
|
|
29706
|
+
type: 11,
|
|
29504
29707
|
elements: [id],
|
|
29505
29708
|
parent: context.reference()
|
|
29506
29709
|
});
|
|
29507
29710
|
} else {
|
|
29508
29711
|
context.childrenTemplate = [" "];
|
|
29509
29712
|
context.registerOperation({
|
|
29510
|
-
type:
|
|
29713
|
+
type: 18,
|
|
29511
29714
|
parent: context.reference()
|
|
29512
29715
|
});
|
|
29513
29716
|
}
|
|
29514
29717
|
context.registerEffect([exp], {
|
|
29515
|
-
type:
|
|
29718
|
+
type: 6,
|
|
29516
29719
|
element: useCreateElement ? id : context.reference(),
|
|
29517
29720
|
values: [exp],
|
|
29518
29721
|
generated: !useCreateElement
|
|
@@ -29520,7 +29723,7 @@ const transformVText = (dir, node, context) => {
|
|
|
29520
29723
|
}
|
|
29521
29724
|
};
|
|
29522
29725
|
function isConstantVTextExpression(exp, bindings) {
|
|
29523
|
-
if (isConstantExpression(exp)) return true;
|
|
29726
|
+
if (isConstantExpression(exp, bindings)) return true;
|
|
29524
29727
|
if (exp.ast === null) {
|
|
29525
29728
|
const type = bindings[exp.content];
|
|
29526
29729
|
return type === "setup-const" || type === "literal-const";
|
|
@@ -29529,11 +29732,32 @@ function isConstantVTextExpression(exp, bindings) {
|
|
|
29529
29732
|
let isConstant = true;
|
|
29530
29733
|
walkIdentifiers(exp.ast, (id, parent, _parentStack, isReferenced) => {
|
|
29531
29734
|
if (parent && isStaticPropertyKey(id, parent)) return;
|
|
29532
|
-
if (isReferenced && !isGloballyAllowed(id.name) && id.name !== "require" || (parent === null || parent === void 0 ? void 0 : parent.type) === "CallExpression" || (parent === null || parent === void 0 ? void 0 : parent.type) === "NewExpression" || (parent === null || parent === void 0 ? void 0 : parent.type) === "MemberExpression") isConstant = false;
|
|
29735
|
+
if (isReferenced && (bindings[id.name] || !isGloballyAllowed(id.name) && id.name !== "require") || (parent === null || parent === void 0 ? void 0 : parent.type) === "CallExpression" || (parent === null || parent === void 0 ? void 0 : parent.type) === "NewExpression" || (parent === null || parent === void 0 ? void 0 : parent.type) === "MemberExpression") isConstant = false;
|
|
29533
29736
|
}, true);
|
|
29534
29737
|
return isConstant;
|
|
29535
29738
|
}
|
|
29536
29739
|
//#endregion
|
|
29740
|
+
//#region packages/compiler-vapor/src/errors.ts
|
|
29741
|
+
function createVaporCompilerError(code, loc) {
|
|
29742
|
+
return createCompilerError(code, loc, VaporErrorMessages);
|
|
29743
|
+
}
|
|
29744
|
+
const VaporErrorCodes = {
|
|
29745
|
+
"X_V_PLACEHOLDER": 100,
|
|
29746
|
+
"100": "X_V_PLACEHOLDER",
|
|
29747
|
+
"X_V_MEMO_NOT_SUPPORTED": 101,
|
|
29748
|
+
"101": "X_V_MEMO_NOT_SUPPORTED",
|
|
29749
|
+
"X_VNODE_HOOKS_NOT_SUPPORTED": 102,
|
|
29750
|
+
"102": "X_VNODE_HOOKS_NOT_SUPPORTED",
|
|
29751
|
+
"__EXTEND_POINT__": 103,
|
|
29752
|
+
"103": "__EXTEND_POINT__"
|
|
29753
|
+
};
|
|
29754
|
+
const VaporErrorMessages = {
|
|
29755
|
+
[100]: `[placeholder]`,
|
|
29756
|
+
[101]: "v-memo is not supported in Vapor mode and will be ignored.",
|
|
29757
|
+
[102]: "@vue:xxx per-element lifecycle events are not supported in Vapor mode and will be ignored.",
|
|
29758
|
+
[103]: ``
|
|
29759
|
+
};
|
|
29760
|
+
//#endregion
|
|
29537
29761
|
//#region packages/compiler-vapor/src/transforms/vOn.ts
|
|
29538
29762
|
const delegatedEvents = /*#__PURE__*/ makeMap("beforeinput,click,dblclick,contextmenu,focusin,focusout,input,keydown,keyup,mousedown,mousemove,mouseout,mouseover,mouseup,pointerdown,pointermove,pointerout,pointerover,pointerup,touchend,touchmove,touchstart");
|
|
29539
29763
|
const transformVOn = (dir, node, context) => {
|
|
@@ -29552,7 +29776,13 @@ const transformVOn = (dir, node, context) => {
|
|
|
29552
29776
|
}
|
|
29553
29777
|
if (nonDelegateModifiers) modifiers = nonDelegateModifiers;
|
|
29554
29778
|
arg = resolveExpression(arg);
|
|
29555
|
-
if (arg.isStatic && arg.content.startsWith("vue:"))
|
|
29779
|
+
if (arg.isStatic && arg.content.startsWith("vue:")) {
|
|
29780
|
+
if (node.tagType === 0) {
|
|
29781
|
+
context.options.onWarn(createVaporCompilerError(102, loc));
|
|
29782
|
+
return;
|
|
29783
|
+
}
|
|
29784
|
+
arg = extend({}, arg, { content: `vnode-${arg.content.slice(4)}` });
|
|
29785
|
+
}
|
|
29556
29786
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(arg.isStatic ? `on${arg.content}` : arg, modifiers, null, loc);
|
|
29557
29787
|
let keyOverride;
|
|
29558
29788
|
const isStaticClick = arg.isStatic && arg.content.toLowerCase() === "click";
|
|
@@ -29582,7 +29812,7 @@ const transformVOn = (dir, node, context) => {
|
|
|
29582
29812
|
else if (delegateModifier && !isDelegatableEvent) warnDelegate(context, delegateModifier, `.delegate modifier is not supported on the "${arg.content}" event. The listener will be attached directly.`);
|
|
29583
29813
|
const delegate = isDelegatableEvent && !eventOptionModifiers.length && !hasStopHandler;
|
|
29584
29814
|
const operation = {
|
|
29585
|
-
type:
|
|
29815
|
+
type: 7,
|
|
29586
29816
|
element: context.reference(),
|
|
29587
29817
|
key: arg,
|
|
29588
29818
|
value: exp,
|
|
@@ -29632,7 +29862,7 @@ const transformVShow = (dir, node, context) => {
|
|
|
29632
29862
|
return;
|
|
29633
29863
|
}
|
|
29634
29864
|
context.registerOperation({
|
|
29635
|
-
type:
|
|
29865
|
+
type: 14,
|
|
29636
29866
|
element: context.reference(),
|
|
29637
29867
|
dir,
|
|
29638
29868
|
name: "show",
|
|
@@ -29652,9 +29882,9 @@ const transformTemplateRef = (node, context) => {
|
|
|
29652
29882
|
else value = dir.value ? createSimpleExpression(dir.value.content, true, dir.value.loc) : EMPTY_EXPRESSION;
|
|
29653
29883
|
return () => {
|
|
29654
29884
|
const id = context.reference();
|
|
29655
|
-
const effect = !isConstantExpression(value);
|
|
29885
|
+
const effect = !isConstantExpression(value, context.options.bindingMetadata);
|
|
29656
29886
|
context.registerEffect([value], {
|
|
29657
|
-
type:
|
|
29887
|
+
type: 10,
|
|
29658
29888
|
element: id,
|
|
29659
29889
|
value,
|
|
29660
29890
|
refFor: !!context.inVFor,
|
|
@@ -29676,12 +29906,20 @@ const transformVModel = (dir, node, context) => {
|
|
|
29676
29906
|
context.options.onError(createCompilerError(44, exp.loc));
|
|
29677
29907
|
return;
|
|
29678
29908
|
}
|
|
29909
|
+
if (bindingType === "literal-const" || bindingType === "setup-const") {
|
|
29910
|
+
context.options.onError(createCompilerError(45, exp.loc));
|
|
29911
|
+
return;
|
|
29912
|
+
}
|
|
29679
29913
|
const expString = exp.content;
|
|
29680
29914
|
const maybeRef = context.options.inline && (bindingType === "setup-let" || bindingType === "setup-ref" || bindingType === "setup-maybe-ref");
|
|
29681
29915
|
if (!expString.trim() || !isMemberExpression$1(exp, context.options) && !maybeRef) {
|
|
29682
29916
|
context.options.onError(createCompilerError(42, exp.loc));
|
|
29683
29917
|
return;
|
|
29684
29918
|
}
|
|
29919
|
+
if (isScopeVariable(expString.trim(), context)) {
|
|
29920
|
+
context.options.onError(createCompilerError(43, exp.loc));
|
|
29921
|
+
return;
|
|
29922
|
+
}
|
|
29685
29923
|
if (node.tagType === 1) return {
|
|
29686
29924
|
key: arg ? arg : createSimpleExpression("modelValue", true),
|
|
29687
29925
|
value: exp,
|
|
@@ -29716,7 +29954,7 @@ const transformVModel = (dir, node, context) => {
|
|
|
29716
29954
|
else checkDuplicatedValue();
|
|
29717
29955
|
} else context.options.onError(createDOMCompilerError(58, dir.loc));
|
|
29718
29956
|
if (modelType) context.registerOperation({
|
|
29719
|
-
type:
|
|
29957
|
+
type: 14,
|
|
29720
29958
|
element: context.reference(),
|
|
29721
29959
|
dir,
|
|
29722
29960
|
name: "model",
|
|
@@ -29729,34 +29967,22 @@ const transformVModel = (dir, node, context) => {
|
|
|
29729
29967
|
if (value && isStaticArgOf(value.arg, "value")) context.options.onError(createDOMCompilerError(61, value.loc));
|
|
29730
29968
|
}
|
|
29731
29969
|
};
|
|
29732
|
-
|
|
29733
|
-
|
|
29734
|
-
const
|
|
29735
|
-
|
|
29736
|
-
|
|
29737
|
-
|
|
29738
|
-
|
|
29739
|
-
|
|
29740
|
-
|
|
29741
|
-
|
|
29742
|
-
|
|
29743
|
-
|
|
29744
|
-
|
|
29745
|
-
|
|
29746
|
-
context.dynamic.flags |= 2;
|
|
29747
|
-
} else context.template += `<!--${node.content}-->`;
|
|
29748
|
-
};
|
|
29749
|
-
function getSiblingIf(context, reverse) {
|
|
29750
|
-
const parent = context.parent;
|
|
29751
|
-
if (!parent) return;
|
|
29752
|
-
const siblings = parent.node.children;
|
|
29753
|
-
let sibling;
|
|
29754
|
-
let i = siblings.indexOf(context.node);
|
|
29755
|
-
while (reverse ? --i >= 0 : ++i < siblings.length) {
|
|
29756
|
-
sibling = siblings[i];
|
|
29757
|
-
if (!isCommentOrWhitespace(sibling)) break;
|
|
29970
|
+
function isScopeVariable(name, context) {
|
|
29971
|
+
for (let parent = context.parent; parent; parent = parent.parent) {
|
|
29972
|
+
const { node } = parent;
|
|
29973
|
+
if (node.type !== 1) continue;
|
|
29974
|
+
const vFor = findDir$1(node, "for");
|
|
29975
|
+
const aliases = vFor && vFor.forParseResult;
|
|
29976
|
+
const scopes = aliases ? [
|
|
29977
|
+
aliases.value,
|
|
29978
|
+
aliases.key,
|
|
29979
|
+
aliases.index
|
|
29980
|
+
] : [];
|
|
29981
|
+
const slot = findDir$1(node, "slot");
|
|
29982
|
+
if (slot) scopes.push(slot.exp);
|
|
29983
|
+
if (scopes.some((exp) => hasScopeBinding(name, exp))) return true;
|
|
29758
29984
|
}
|
|
29759
|
-
|
|
29985
|
+
return false;
|
|
29760
29986
|
}
|
|
29761
29987
|
//#endregion
|
|
29762
29988
|
//#region packages/compiler-vapor/src/transforms/vIf.ts
|
|
@@ -29782,7 +30008,7 @@ function processIf(node, dir, context) {
|
|
|
29782
30008
|
return () => {
|
|
29783
30009
|
onExit();
|
|
29784
30010
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
29785
|
-
type:
|
|
30011
|
+
type: 15,
|
|
29786
30012
|
id
|
|
29787
30013
|
}, context.effectBoundary()), {}, {
|
|
29788
30014
|
blockShape: encodeIfBlockShape(branch, forceMultiRoot, void 0, allowNoScope),
|
|
@@ -29798,16 +30024,16 @@ function processIf(node, dir, context) {
|
|
|
29798
30024
|
let lastIfNode;
|
|
29799
30025
|
if (siblings) {
|
|
29800
30026
|
let i = siblings.length;
|
|
29801
|
-
while (i--) if (siblings[i].operation && siblings[i].operation.type ===
|
|
30027
|
+
while (i--) if (siblings[i].operation && siblings[i].operation.type === 15) {
|
|
29802
30028
|
lastIfNode = siblings[i].operation;
|
|
29803
30029
|
break;
|
|
29804
30030
|
}
|
|
29805
30031
|
}
|
|
29806
|
-
if (!siblingIf || !lastIfNode || lastIfNode.type !==
|
|
30032
|
+
if (!siblingIf || !lastIfNode || lastIfNode.type !== 15) {
|
|
29807
30033
|
context.options.onError(createCompilerError(30, node.loc));
|
|
29808
30034
|
return;
|
|
29809
30035
|
}
|
|
29810
|
-
while (lastIfNode.negative && lastIfNode.negative.type ===
|
|
30036
|
+
while (lastIfNode.negative && lastIfNode.negative.type === 15) lastIfNode = lastIfNode.negative;
|
|
29811
30037
|
if (dir.name === "else-if" && lastIfNode.negative) context.options.onError(createCompilerError(30, node.loc));
|
|
29812
30038
|
checkSameKey(node, context);
|
|
29813
30039
|
const comments = context.comment;
|
|
@@ -29821,7 +30047,7 @@ function processIf(node, dir, context) {
|
|
|
29821
30047
|
const [branch, onExit] = createIfBranch(node, context);
|
|
29822
30048
|
if (dir.name === "else") lastIfNode.negative = branch;
|
|
29823
30049
|
else lastIfNode.negative = {
|
|
29824
|
-
type:
|
|
30050
|
+
type: 15,
|
|
29825
30051
|
id: -1,
|
|
29826
30052
|
condition: dir.exp,
|
|
29827
30053
|
positive: branch,
|
|
@@ -29831,7 +30057,7 @@ function processIf(node, dir, context) {
|
|
|
29831
30057
|
};
|
|
29832
30058
|
return () => {
|
|
29833
30059
|
onExit();
|
|
29834
|
-
if (lastIfNode.negative.type ===
|
|
30060
|
+
if (lastIfNode.negative.type === 15) lastIfNode.negative.blockShape = encodeIfBlockShape(lastIfNode.negative.positive, forceMultiRoot, void 0, allowNoScope);
|
|
29835
30061
|
lastIfNode.blockShape = encodeIfBlockShape(lastIfNode.positive, forceMultiRoot, lastIfNode.negative, allowNoScope);
|
|
29836
30062
|
};
|
|
29837
30063
|
}
|
|
@@ -29850,12 +30076,12 @@ function createIfBranch(node, context) {
|
|
|
29850
30076
|
function encodeIfBlockShape(positive, forceMultiRoot = false, negative, allowNoScope = true) {
|
|
29851
30077
|
if (forceMultiRoot) return 10;
|
|
29852
30078
|
const positiveNoScope = allowNoScope && canSkipIfBranchScope(positive);
|
|
29853
|
-
const negativeNoScope = allowNoScope && negative && negative.type !==
|
|
30079
|
+
const negativeNoScope = allowNoScope && negative && negative.type !== 15 && canSkipIfBranchScope(negative);
|
|
29854
30080
|
return getBlockShape(positive) | getNegativeIfBranchShape(negative) << 2 | (positiveNoScope ? 32 : 0) | (negativeNoScope ? 64 : 0);
|
|
29855
30081
|
}
|
|
29856
30082
|
function getNegativeIfBranchShape(negative) {
|
|
29857
30083
|
if (!negative) return 0;
|
|
29858
|
-
return negative.type ===
|
|
30084
|
+
return negative.type === 15 ? 1 : getBlockShape(negative);
|
|
29859
30085
|
}
|
|
29860
30086
|
function canSkipIfBranchScope(block) {
|
|
29861
30087
|
if (block.effect.length || block.operation.length) return false;
|
|
@@ -29941,7 +30167,7 @@ function processFor(node, dir, context) {
|
|
|
29941
30167
|
const { parent } = context;
|
|
29942
30168
|
const isOnlyChild = parent && parent.block.node !== parent.node && parent.node.children.length === 1;
|
|
29943
30169
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
29944
|
-
type:
|
|
30170
|
+
type: 16,
|
|
29945
30171
|
id
|
|
29946
30172
|
}, context.effectBoundary()), {}, {
|
|
29947
30173
|
source,
|
|
@@ -30001,7 +30227,7 @@ const transformSlotOutlet = (node, context) => {
|
|
|
30001
30227
|
if (context.options.scopeId && !context.options.slotted) flags |= 1;
|
|
30002
30228
|
if (context.inVOnce) flags |= 2;
|
|
30003
30229
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
30004
|
-
type:
|
|
30230
|
+
type: 13,
|
|
30005
30231
|
id
|
|
30006
30232
|
}, context.effectBoundary()), {}, {
|
|
30007
30233
|
name: slotName,
|
|
@@ -30192,6 +30418,13 @@ function hasMultipleChildren(node) {
|
|
|
30192
30418
|
return children.length !== 1;
|
|
30193
30419
|
}
|
|
30194
30420
|
//#endregion
|
|
30421
|
+
//#region packages/compiler-vapor/src/transforms/vMemo.ts
|
|
30422
|
+
const transformVMemo = (node, context) => {
|
|
30423
|
+
if (node.type !== 1) return;
|
|
30424
|
+
const memo = findDir$1(node, "memo", true);
|
|
30425
|
+
if (memo) context.options.onWarn(createVaporCompilerError(101, memo.loc));
|
|
30426
|
+
};
|
|
30427
|
+
//#endregion
|
|
30195
30428
|
//#region packages/compiler-vapor/src/compile.ts
|
|
30196
30429
|
function compile$1(source, options = {}) {
|
|
30197
30430
|
const resolvedOptions = extend({}, options);
|
|
@@ -30216,6 +30449,7 @@ function getBaseTransformPreset() {
|
|
|
30216
30449
|
transformVIf,
|
|
30217
30450
|
transformVFor,
|
|
30218
30451
|
transformKey,
|
|
30452
|
+
transformVMemo,
|
|
30219
30453
|
transformSlotOutlet,
|
|
30220
30454
|
transformTemplateRef,
|
|
30221
30455
|
transformElement,
|
|
@@ -30233,21 +30467,6 @@ function getBaseTransformPreset() {
|
|
|
30233
30467
|
}];
|
|
30234
30468
|
}
|
|
30235
30469
|
//#endregion
|
|
30236
|
-
//#region packages/compiler-vapor/src/errors.ts
|
|
30237
|
-
function createVaporCompilerError(code, loc) {
|
|
30238
|
-
return createCompilerError(code, loc, VaporErrorMessages);
|
|
30239
|
-
}
|
|
30240
|
-
const VaporErrorCodes = {
|
|
30241
|
-
"X_V_PLACEHOLDER": 100,
|
|
30242
|
-
"100": "X_V_PLACEHOLDER",
|
|
30243
|
-
"__EXTEND_POINT__": 101,
|
|
30244
|
-
"101": "__EXTEND_POINT__"
|
|
30245
|
-
};
|
|
30246
|
-
const VaporErrorMessages = {
|
|
30247
|
-
[100]: `[placeholder]`,
|
|
30248
|
-
[101]: ``
|
|
30249
|
-
};
|
|
30250
|
-
//#endregion
|
|
30251
30470
|
//#region packages/compiler-vapor/src/index.ts
|
|
30252
30471
|
var src_exports$1 = /* @__PURE__ */ __exportAll({
|
|
30253
30472
|
CodegenContext: () => CodegenContext,
|
|
@@ -30292,6 +30511,7 @@ var src_exports$1 = /* @__PURE__ */ __exportAll({
|
|
|
30292
30511
|
//#region packages/compiler-ssr/src/runtimeHelpers.ts
|
|
30293
30512
|
const SSR_INTERPOLATE = Symbol(`ssrInterpolate`);
|
|
30294
30513
|
const SSR_RENDER_VNODE = Symbol(`ssrRenderVNode`);
|
|
30514
|
+
const SSR_RENDER_DYNAMIC_COMPONENT = Symbol(`ssrRenderDynamicComponent`);
|
|
30295
30515
|
const SSR_RENDER_COMPONENT = Symbol(`ssrRenderComponent`);
|
|
30296
30516
|
const SSR_RENDER_SLOT = Symbol(`ssrRenderSlot`);
|
|
30297
30517
|
const SSR_RENDER_SLOT_INNER = Symbol(`ssrRenderSlotInner`);
|
|
@@ -30312,6 +30532,7 @@ const SSR_GET_DIRECTIVE_PROPS = Symbol(`ssrGetDirectiveProps`);
|
|
|
30312
30532
|
const ssrHelpers = {
|
|
30313
30533
|
[SSR_INTERPOLATE]: `ssrInterpolate`,
|
|
30314
30534
|
[SSR_RENDER_VNODE]: `ssrRenderVNode`,
|
|
30535
|
+
[SSR_RENDER_DYNAMIC_COMPONENT]: `ssrRenderDynamicComponent`,
|
|
30315
30536
|
[SSR_RENDER_COMPONENT]: `ssrRenderComponent`,
|
|
30316
30537
|
[SSR_RENDER_SLOT]: `ssrRenderSlot`,
|
|
30317
30538
|
[SSR_RENDER_SLOT_INNER]: `ssrRenderSlotInner`,
|
|
@@ -30427,7 +30648,7 @@ function ssrProcessSuspense(node, context) {
|
|
|
30427
30648
|
const { slotsExp, wipSlots } = wipEntry;
|
|
30428
30649
|
for (let i = 0; i < wipSlots.length; i++) {
|
|
30429
30650
|
const slot = wipSlots[i];
|
|
30430
|
-
slot.fn.body = processChildrenAsStatement(slot, context);
|
|
30651
|
+
slot.fn.body = processChildrenAsStatement(slot, context, !!context.options.vapor);
|
|
30431
30652
|
}
|
|
30432
30653
|
context.pushStatement(createCallExpression(context.helper(SSR_RENDER_SUSPENSE), [`_push`, slotsExp]));
|
|
30433
30654
|
}
|
|
@@ -30708,7 +30929,14 @@ const ssrTransformComponent = (node, context) => {
|
|
|
30708
30929
|
return fn;
|
|
30709
30930
|
};
|
|
30710
30931
|
const slots = node.children.length ? buildSlots(node, context, buildSSRSlotFn).slots : `null`;
|
|
30711
|
-
if (typeof component !== "string") node.ssrCodegenNode = createCallExpression(context.helper(
|
|
30932
|
+
if (typeof component !== "string" && rawOptionsMap.get(context.root).vapor) node.ssrCodegenNode = createCallExpression(context.helper(SSR_RENDER_DYNAMIC_COMPONENT), [
|
|
30933
|
+
`_push`,
|
|
30934
|
+
component,
|
|
30935
|
+
propsExp,
|
|
30936
|
+
slots,
|
|
30937
|
+
`_parent`
|
|
30938
|
+
]);
|
|
30939
|
+
else if (typeof component !== "string") node.ssrCodegenNode = createCallExpression(context.helper(SSR_RENDER_VNODE), [
|
|
30712
30940
|
`_push`,
|
|
30713
30941
|
createCallExpression(context.helper(CREATE_VNODE), [
|
|
30714
30942
|
component,
|
|
@@ -31360,10 +31588,10 @@ var require_picocolors_browser = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
31360
31588
|
module.exports.createColors = create;
|
|
31361
31589
|
}));
|
|
31362
31590
|
//#endregion
|
|
31363
|
-
//#region (ignored) node_modules/.pnpm/postcss@8.5.
|
|
31591
|
+
//#region (ignored) node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/terminal-highlight
|
|
31364
31592
|
var require_terminal_highlight = /* @__PURE__ */ __commonJSMin((() => {}));
|
|
31365
31593
|
//#endregion
|
|
31366
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
31594
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/css-syntax-error.js
|
|
31367
31595
|
var require_css_syntax_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31368
31596
|
let pico = require_picocolors_browser();
|
|
31369
31597
|
let terminalHighlight = require_terminal_highlight();
|
|
@@ -31440,16 +31668,9 @@ var require_css_syntax_error = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
31440
31668
|
CssSyntaxError.default = CssSyntaxError;
|
|
31441
31669
|
}));
|
|
31442
31670
|
//#endregion
|
|
31443
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
31671
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/stringifier.js
|
|
31444
31672
|
var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31445
|
-
const STYLE_TAG = /(<)(\/?style\b)/gi;
|
|
31446
|
-
const COMMENT_OPEN = /(<)(!--)/g;
|
|
31447
31673
|
const AT_NAME_END = /[\t\n\f\r "#'()/;[\\\]{}]/;
|
|
31448
|
-
function escapeHTMLInCSS(str) {
|
|
31449
|
-
if (typeof str !== "string") return str;
|
|
31450
|
-
if (!str.includes("<")) return str;
|
|
31451
|
-
return str.replace(STYLE_TAG, "\\3c $2").replace(COMMENT_OPEN, "\\3c $2");
|
|
31452
|
-
}
|
|
31453
31674
|
const DEFAULT_RAW = {
|
|
31454
31675
|
after: "\n",
|
|
31455
31676
|
beforeClose: "\n",
|
|
@@ -31478,7 +31699,7 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31478
31699
|
function isCustomProperty(node) {
|
|
31479
31700
|
if (!node.prop.startsWith("--")) return false;
|
|
31480
31701
|
let before = node.raws.before;
|
|
31481
|
-
return typeof before === "undefined" ||
|
|
31702
|
+
return typeof before === "undefined" || !/[^\s;]$/.test(before);
|
|
31482
31703
|
}
|
|
31483
31704
|
function pushBody(str, stack, node) {
|
|
31484
31705
|
let nodes = node.nodes;
|
|
@@ -31502,13 +31723,13 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31502
31723
|
}
|
|
31503
31724
|
function pushBlock(str, stack, node, start) {
|
|
31504
31725
|
let between = str.raw(node, "between", "beforeOpen");
|
|
31505
|
-
str.builder(
|
|
31726
|
+
str.builder(start + between + "{", node, "start");
|
|
31506
31727
|
let hasNodes = node.nodes && node.nodes.length;
|
|
31507
31728
|
let close = () => {
|
|
31508
31729
|
let after = hasNodes ? str.raw(node, "after") : str.raw(node, "after", "emptyBody");
|
|
31509
|
-
if (after) str.builder(
|
|
31730
|
+
if (after) str.builder(after);
|
|
31510
31731
|
str.builder("}", node, "end");
|
|
31511
|
-
if (node.type === "rule" && node.raws.ownSemicolon) str.builder(
|
|
31732
|
+
if (node.type === "rule" && node.raws.ownSemicolon) str.builder(node.raws.ownSemicolon, node, "end");
|
|
31512
31733
|
};
|
|
31513
31734
|
if (hasNodes) {
|
|
31514
31735
|
stack.push(close);
|
|
@@ -31524,7 +31745,7 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31524
31745
|
if (node.nodes) this.block(node, start);
|
|
31525
31746
|
else {
|
|
31526
31747
|
let end = (node.raws.between || "") + (semicolon ? ";" : "");
|
|
31527
|
-
this.builder(
|
|
31748
|
+
this.builder(start + end, node);
|
|
31528
31749
|
}
|
|
31529
31750
|
}
|
|
31530
31751
|
beforeAfter(node, detect) {
|
|
@@ -31547,13 +31768,13 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31547
31768
|
}
|
|
31548
31769
|
block(node, start) {
|
|
31549
31770
|
let between = this.raw(node, "between", "beforeOpen");
|
|
31550
|
-
this.builder(
|
|
31771
|
+
this.builder(start + between + "{", node, "start");
|
|
31551
31772
|
let after;
|
|
31552
31773
|
if (node.nodes && node.nodes.length) {
|
|
31553
31774
|
this.body(node);
|
|
31554
31775
|
after = this.raw(node, "after");
|
|
31555
31776
|
} else after = this.raw(node, "after", "emptyBody");
|
|
31556
|
-
if (after) this.builder(
|
|
31777
|
+
if (after) this.builder(after);
|
|
31557
31778
|
this.builder("}", node, "end");
|
|
31558
31779
|
}
|
|
31559
31780
|
body(node) {
|
|
@@ -31575,7 +31796,7 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31575
31796
|
}
|
|
31576
31797
|
let child = entry.node;
|
|
31577
31798
|
let before = this.raw(child, "before");
|
|
31578
|
-
if (before) this.builder(
|
|
31799
|
+
if (before) this.builder(before);
|
|
31579
31800
|
if (expandable && child.type === "rule") pushBlock(this, stack, child, this.rawValue(child, "selector"));
|
|
31580
31801
|
else if (expandable && child.type === "atrule" && child.nodes) pushBlock(this, stack, child, atruleStart(this, child));
|
|
31581
31802
|
else this.stringify(child, entry.semicolon);
|
|
@@ -31584,7 +31805,7 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31584
31805
|
comment(node) {
|
|
31585
31806
|
let left = this.raw(node, "left", "commentLeft");
|
|
31586
31807
|
let right = this.raw(node, "right", "commentRight");
|
|
31587
|
-
this.builder(
|
|
31808
|
+
this.builder("/*" + left + node.text + right + "*/", node);
|
|
31588
31809
|
}
|
|
31589
31810
|
decl(node, semicolon) {
|
|
31590
31811
|
let raws = node.raws;
|
|
@@ -31592,7 +31813,7 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31592
31813
|
let string = node.prop + between + this.rawValue(node, "value");
|
|
31593
31814
|
if (node.important) string += raws.important || " !important";
|
|
31594
31815
|
if (semicolon) string += ";";
|
|
31595
|
-
this.builder(
|
|
31816
|
+
this.builder(string, node);
|
|
31596
31817
|
}
|
|
31597
31818
|
document(node) {
|
|
31598
31819
|
this.body(node);
|
|
@@ -31743,17 +31964,13 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31743
31964
|
return value;
|
|
31744
31965
|
}
|
|
31745
31966
|
root(node) {
|
|
31746
|
-
if (node.source && node.source.input.hasBOM) this.builder("", node, "start");
|
|
31967
|
+
if (!(node.parent && node.parent.type === "document") && node.source && node.source.input.hasBOM) this.builder("", node, "start");
|
|
31747
31968
|
this.body(node);
|
|
31748
|
-
if (node.raws.after)
|
|
31749
|
-
let after = node.raws.after;
|
|
31750
|
-
let isDocument = node.parent && node.parent.type === "document";
|
|
31751
|
-
this.builder(isDocument ? after : escapeHTMLInCSS(after));
|
|
31752
|
-
}
|
|
31969
|
+
if (node.raws.after) this.builder(node.raws.after);
|
|
31753
31970
|
}
|
|
31754
31971
|
rule(node) {
|
|
31755
31972
|
this.block(node, this.rawValue(node, "selector"));
|
|
31756
|
-
if (node.raws.ownSemicolon) this.builder(
|
|
31973
|
+
if (node.raws.ownSemicolon) this.builder(node.raws.ownSemicolon, node, "end");
|
|
31757
31974
|
}
|
|
31758
31975
|
stringify(node, semicolon) {
|
|
31759
31976
|
/* c8 ignore start */
|
|
@@ -31766,23 +31983,62 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31766
31983
|
Stringifier.default = Stringifier;
|
|
31767
31984
|
}));
|
|
31768
31985
|
//#endregion
|
|
31769
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
31986
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/stringify.js
|
|
31770
31987
|
var require_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31771
31988
|
let Stringifier = require_stringifier();
|
|
31989
|
+
const STYLE_TAG = /(<)(\/?style\b)/gi;
|
|
31990
|
+
const COMMENT_OPEN = /(<)(!--)/g;
|
|
31991
|
+
function escapeHTMLInCSS(str) {
|
|
31992
|
+
if (!str.includes("<")) return str;
|
|
31993
|
+
return str.replace(STYLE_TAG, "\\3c $2").replace(COMMENT_OPEN, "\\3c $2");
|
|
31994
|
+
}
|
|
31995
|
+
var SafeStringifier = class extends Stringifier {
|
|
31996
|
+
escapeHTML(node, print) {
|
|
31997
|
+
let builder = this.builder;
|
|
31998
|
+
let chunks, css;
|
|
31999
|
+
this.builder = (str, child, type) => {
|
|
32000
|
+
if (chunks) {
|
|
32001
|
+
css += str;
|
|
32002
|
+
chunks.push(str, child, type);
|
|
32003
|
+
} else if (str.includes("<")) {
|
|
32004
|
+
css = str;
|
|
32005
|
+
chunks = [
|
|
32006
|
+
str,
|
|
32007
|
+
child,
|
|
32008
|
+
type
|
|
32009
|
+
];
|
|
32010
|
+
} else builder(str, child, type);
|
|
32011
|
+
};
|
|
32012
|
+
print();
|
|
32013
|
+
this.builder = builder;
|
|
32014
|
+
if (!chunks) return;
|
|
32015
|
+
let escaped = escapeHTMLInCSS(css);
|
|
32016
|
+
if (escaped === css) for (let i = 0; i < chunks.length; i += 3) builder(chunks[i], chunks[i + 1], chunks[i + 2]);
|
|
32017
|
+
else builder(escaped, node);
|
|
32018
|
+
}
|
|
32019
|
+
root(node) {
|
|
32020
|
+
if (node.parent && node.parent.type === "document") {
|
|
32021
|
+
this.escapeHTML(node, () => this.body(node));
|
|
32022
|
+
if (node.raws.after) this.builder(node.raws.after);
|
|
32023
|
+
} else this.escapeHTML(node, () => super.root(node));
|
|
32024
|
+
}
|
|
32025
|
+
};
|
|
31772
32026
|
function stringify(node, builder) {
|
|
31773
|
-
new
|
|
32027
|
+
let str = new SafeStringifier(builder);
|
|
32028
|
+
if (node.type === "root" || node.type === "document") str.stringify(node);
|
|
32029
|
+
else str.escapeHTML(node, () => str.stringify(node));
|
|
31774
32030
|
}
|
|
31775
32031
|
module.exports = stringify;
|
|
31776
32032
|
stringify.default = stringify;
|
|
31777
32033
|
}));
|
|
31778
32034
|
//#endregion
|
|
31779
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32035
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/symbols.js
|
|
31780
32036
|
var require_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31781
32037
|
module.exports.isClean = Symbol("isClean");
|
|
31782
32038
|
module.exports.my = Symbol("my");
|
|
31783
32039
|
}));
|
|
31784
32040
|
//#endregion
|
|
31785
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32041
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/node.js
|
|
31786
32042
|
var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31787
32043
|
let CssSyntaxError = require_css_syntax_error();
|
|
31788
32044
|
let Stringifier = require_stringifier();
|
|
@@ -32144,7 +32400,7 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32144
32400
|
Node.default = Node;
|
|
32145
32401
|
}));
|
|
32146
32402
|
//#endregion
|
|
32147
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32403
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/comment.js
|
|
32148
32404
|
var require_comment$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32149
32405
|
let Node = require_node$1();
|
|
32150
32406
|
var Comment = class extends Node {
|
|
@@ -32157,7 +32413,7 @@ var require_comment$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32157
32413
|
Comment.default = Comment;
|
|
32158
32414
|
}));
|
|
32159
32415
|
//#endregion
|
|
32160
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32416
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/declaration.js
|
|
32161
32417
|
var require_declaration = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32162
32418
|
init_objectSpread2();
|
|
32163
32419
|
let Node = require_node$1();
|
|
@@ -32175,7 +32431,7 @@ var require_declaration = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32175
32431
|
Declaration.default = Declaration;
|
|
32176
32432
|
}));
|
|
32177
32433
|
//#endregion
|
|
32178
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32434
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/container.js
|
|
32179
32435
|
var require_container$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32180
32436
|
let Comment = require_comment$1();
|
|
32181
32437
|
let Declaration = require_declaration();
|
|
@@ -32511,7 +32767,7 @@ var require_container$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32511
32767
|
}));
|
|
32512
32768
|
/* c8 ignore stop */
|
|
32513
32769
|
//#endregion
|
|
32514
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32770
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/at-rule.js
|
|
32515
32771
|
var require_at_rule = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32516
32772
|
let Container = require_container$1();
|
|
32517
32773
|
var AtRule = class extends Container {
|
|
@@ -32533,7 +32789,7 @@ var require_at_rule = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32533
32789
|
Container.registerAtRule(AtRule);
|
|
32534
32790
|
}));
|
|
32535
32791
|
//#endregion
|
|
32536
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32792
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/document.js
|
|
32537
32793
|
var require_document = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32538
32794
|
init_objectSpread2();
|
|
32539
32795
|
let Container = require_container$1();
|
|
@@ -32607,10 +32863,10 @@ var require_non_secure = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32607
32863
|
};
|
|
32608
32864
|
}));
|
|
32609
32865
|
//#endregion
|
|
32610
|
-
//#region (ignored) node_modules/.pnpm/postcss@8.5.
|
|
32866
|
+
//#region (ignored) node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib
|
|
32611
32867
|
var require_lib = /* @__PURE__ */ __commonJSMin((() => {}));
|
|
32612
32868
|
//#endregion
|
|
32613
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32869
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/previous-map.js
|
|
32614
32870
|
var require_previous_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32615
32871
|
init__polyfill_node_buffer();
|
|
32616
32872
|
let { existsSync, readFileSync, realpathSync } = (init__polyfill_node_fs(), __toCommonJS(_polyfill_node_fs_exports));
|
|
@@ -32724,7 +32980,7 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32724
32980
|
PreviousMap.default = PreviousMap;
|
|
32725
32981
|
}));
|
|
32726
32982
|
//#endregion
|
|
32727
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
32983
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/input.js
|
|
32728
32984
|
var require_input = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32729
32985
|
init_objectSpread2();
|
|
32730
32986
|
let { nanoid } = require_non_secure();
|
|
@@ -32924,7 +33180,7 @@ var require_input = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32924
33180
|
if (terminalHighlight && terminalHighlight.registerInput) terminalHighlight.registerInput(Input);
|
|
32925
33181
|
}));
|
|
32926
33182
|
//#endregion
|
|
32927
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
33183
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/root.js
|
|
32928
33184
|
var require_root$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32929
33185
|
let Container = require_container$1();
|
|
32930
33186
|
let LazyResult;
|
|
@@ -32969,7 +33225,7 @@ var require_root$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32969
33225
|
Container.registerRoot(Root);
|
|
32970
33226
|
}));
|
|
32971
33227
|
//#endregion
|
|
32972
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
33228
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/list.js
|
|
32973
33229
|
var require_list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32974
33230
|
let list = {
|
|
32975
33231
|
comma(string) {
|
|
@@ -32991,7 +33247,18 @@ var require_list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32991
33247
|
let inQuote = false;
|
|
32992
33248
|
let prevQuote = "";
|
|
32993
33249
|
let escape = false;
|
|
32994
|
-
|
|
33250
|
+
let inComment = false;
|
|
33251
|
+
for (let i = 0; i < string.length; i++) {
|
|
33252
|
+
let letter = string[i];
|
|
33253
|
+
if (inComment) {
|
|
33254
|
+
current += letter;
|
|
33255
|
+
if (letter === "*" && string[i + 1] === "/") {
|
|
33256
|
+
current += "/";
|
|
33257
|
+
i += 1;
|
|
33258
|
+
inComment = false;
|
|
33259
|
+
}
|
|
33260
|
+
continue;
|
|
33261
|
+
}
|
|
32995
33262
|
if (escape) escape = false;
|
|
32996
33263
|
else if (letter === "\\") escape = true;
|
|
32997
33264
|
else if (inQuote) {
|
|
@@ -32999,6 +33266,11 @@ var require_list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32999
33266
|
} else if (letter === "\"" || letter === "'") {
|
|
33000
33267
|
inQuote = true;
|
|
33001
33268
|
prevQuote = letter;
|
|
33269
|
+
} else if (letter === "/" && string[i + 1] === "*") {
|
|
33270
|
+
current += "/*";
|
|
33271
|
+
i += 1;
|
|
33272
|
+
inComment = true;
|
|
33273
|
+
continue;
|
|
33002
33274
|
} else if (letter === "(") func += 1;
|
|
33003
33275
|
else if (letter === ")") {
|
|
33004
33276
|
if (func > 0) func -= 1;
|
|
@@ -33021,7 +33293,7 @@ var require_list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
33021
33293
|
list.default = list;
|
|
33022
33294
|
}));
|
|
33023
33295
|
//#endregion
|
|
33024
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
33296
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/rule.js
|
|
33025
33297
|
var require_rule = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
33026
33298
|
let Container = require_container$1();
|
|
33027
33299
|
let list = require_list();
|
|
@@ -33045,7 +33317,7 @@ var require_rule = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
33045
33317
|
Container.registerRule(Rule);
|
|
33046
33318
|
}));
|
|
33047
33319
|
//#endregion
|
|
33048
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
33320
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/fromJSON.js
|
|
33049
33321
|
var require_fromJSON = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
33050
33322
|
init_objectSpread2();
|
|
33051
33323
|
init_objectWithoutProperties();
|
|
@@ -33121,7 +33393,7 @@ var require_fromJSON = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
33121
33393
|
fromJSON.default = fromJSON;
|
|
33122
33394
|
}));
|
|
33123
33395
|
//#endregion
|
|
33124
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
33396
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/map-generator.js
|
|
33125
33397
|
var require_map_generator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
33126
33398
|
init__polyfill_node_buffer();
|
|
33127
33399
|
let { dirname, relative, resolve, sep } = (init__polyfill_node_path(), __toCommonJS(_polyfill_node_path_exports));
|
|
@@ -33176,13 +33448,17 @@ var require_map_generator = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
33176
33448
|
}
|
|
33177
33449
|
} else if (this.css) {
|
|
33178
33450
|
let annotation = "/*# sourceMappingURL=";
|
|
33451
|
+
let css = "";
|
|
33452
|
+
let cursor = 0;
|
|
33179
33453
|
let startIndex;
|
|
33180
|
-
while ((startIndex = this.css.
|
|
33454
|
+
while ((startIndex = this.css.indexOf(annotation, cursor)) !== -1) {
|
|
33181
33455
|
let endIndex = this.css.indexOf("*/", startIndex + 21);
|
|
33182
33456
|
if (endIndex === -1) break;
|
|
33183
|
-
while (startIndex >
|
|
33184
|
-
|
|
33457
|
+
while (startIndex > cursor && this.css[startIndex - 1] === "\n") startIndex--;
|
|
33458
|
+
css += this.css.slice(cursor, startIndex);
|
|
33459
|
+
cursor = endIndex + 2;
|
|
33185
33460
|
}
|
|
33461
|
+
if (cursor > 0) this.css = css + this.css.slice(cursor);
|
|
33186
33462
|
}
|
|
33187
33463
|
}
|
|
33188
33464
|
generate() {
|
|
@@ -33393,7 +33669,7 @@ var require_map_generator = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
33393
33669
|
module.exports = MapGenerator;
|
|
33394
33670
|
}));
|
|
33395
33671
|
//#endregion
|
|
33396
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
33672
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/tokenize.js
|
|
33397
33673
|
var require_tokenize$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
33398
33674
|
const SINGLE_QUOTE = "'".charCodeAt(0);
|
|
33399
33675
|
const DOUBLE_QUOTE = "\"".charCodeAt(0);
|
|
@@ -33630,7 +33906,7 @@ var require_tokenize$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
33630
33906
|
};
|
|
33631
33907
|
}));
|
|
33632
33908
|
//#endregion
|
|
33633
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
33909
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/parser.js
|
|
33634
33910
|
var require_parser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
33635
33911
|
let AtRule = require_at_rule();
|
|
33636
33912
|
let Comment = require_comment$1();
|
|
@@ -34004,6 +34280,7 @@ var require_parser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34004
34280
|
let token, type;
|
|
34005
34281
|
let length = tokens.length;
|
|
34006
34282
|
let value = "";
|
|
34283
|
+
let last = "";
|
|
34007
34284
|
let clean = true;
|
|
34008
34285
|
let next, prev;
|
|
34009
34286
|
for (let i = 0; i < length; i += 1) {
|
|
@@ -34014,10 +34291,16 @@ var require_parser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34014
34291
|
prev = tokens[i - 1] ? tokens[i - 1][0] : "empty";
|
|
34015
34292
|
next = tokens[i + 1] ? tokens[i + 1][0] : "empty";
|
|
34016
34293
|
if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
|
|
34017
|
-
if (
|
|
34018
|
-
else
|
|
34294
|
+
if (last === ",") clean = false;
|
|
34295
|
+
else {
|
|
34296
|
+
value += token[1];
|
|
34297
|
+
last = token[1].slice(-1);
|
|
34298
|
+
}
|
|
34019
34299
|
} else clean = false;
|
|
34020
|
-
} else
|
|
34300
|
+
} else {
|
|
34301
|
+
value += token[1];
|
|
34302
|
+
last = token[1].slice(-1);
|
|
34303
|
+
}
|
|
34021
34304
|
}
|
|
34022
34305
|
if (!clean) {
|
|
34023
34306
|
let raw = tokens.reduce((all, i) => all + i[1], "");
|
|
@@ -34092,7 +34375,7 @@ var require_parser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34092
34375
|
module.exports = Parser;
|
|
34093
34376
|
}));
|
|
34094
34377
|
//#endregion
|
|
34095
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
34378
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/parse.js
|
|
34096
34379
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
34097
34380
|
let Container = require_container$1();
|
|
34098
34381
|
let Input = require_input();
|
|
@@ -34117,7 +34400,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34117
34400
|
Container.registerParse(parse);
|
|
34118
34401
|
}));
|
|
34119
34402
|
//#endregion
|
|
34120
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
34403
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/warning.js
|
|
34121
34404
|
var require_warning = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
34122
34405
|
let Container = require_container$1();
|
|
34123
34406
|
let { my } = require_symbols();
|
|
@@ -34149,7 +34432,7 @@ var require_warning = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34149
34432
|
Warning.default = Warning;
|
|
34150
34433
|
}));
|
|
34151
34434
|
//#endregion
|
|
34152
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
34435
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/result.js
|
|
34153
34436
|
var require_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
34154
34437
|
let Warning = require_warning();
|
|
34155
34438
|
var Result = class {
|
|
@@ -34183,7 +34466,7 @@ var require_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34183
34466
|
Result.default = Result;
|
|
34184
34467
|
}));
|
|
34185
34468
|
//#endregion
|
|
34186
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
34469
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/warn-once.js
|
|
34187
34470
|
var require_warn_once = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
34188
34471
|
let printed = {};
|
|
34189
34472
|
module.exports = function warnOnce(message) {
|
|
@@ -34193,7 +34476,7 @@ var require_warn_once = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34193
34476
|
};
|
|
34194
34477
|
}));
|
|
34195
34478
|
//#endregion
|
|
34196
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
34479
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/lazy-result.js
|
|
34197
34480
|
var require_lazy_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
34198
34481
|
init_objectSpread2();
|
|
34199
34482
|
init_asyncToGenerator();
|
|
@@ -34661,7 +34944,7 @@ var require_lazy_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34661
34944
|
Document.registerLazyResult(LazyResult);
|
|
34662
34945
|
}));
|
|
34663
34946
|
//#endregion
|
|
34664
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
34947
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/no-work-result.js
|
|
34665
34948
|
var require_no_work_result = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
34666
34949
|
let MapGenerator = require_map_generator();
|
|
34667
34950
|
let parse = require_parse();
|
|
@@ -34758,7 +35041,7 @@ var require_no_work_result = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
34758
35041
|
NoWorkResult.default = NoWorkResult;
|
|
34759
35042
|
}));
|
|
34760
35043
|
//#endregion
|
|
34761
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
35044
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/processor.js
|
|
34762
35045
|
var require_processor$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
34763
35046
|
let Document = require_document();
|
|
34764
35047
|
let LazyResult = require_lazy_result();
|
|
@@ -34766,7 +35049,7 @@ var require_processor$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34766
35049
|
let Root = require_root$1();
|
|
34767
35050
|
var Processor = class {
|
|
34768
35051
|
constructor(plugins = []) {
|
|
34769
|
-
this.version = "8.5.
|
|
35052
|
+
this.version = "8.5.29";
|
|
34770
35053
|
this.plugins = this.normalize(plugins);
|
|
34771
35054
|
}
|
|
34772
35055
|
normalize(plugins) {
|
|
@@ -34797,7 +35080,7 @@ var require_processor$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34797
35080
|
Document.registerProcessor(Processor);
|
|
34798
35081
|
}));
|
|
34799
35082
|
//#endregion
|
|
34800
|
-
//#region node_modules/.pnpm/postcss@8.5.
|
|
35083
|
+
//#region node_modules/.pnpm/postcss@8.5.29/node_modules/postcss/lib/postcss.mjs
|
|
34801
35084
|
var import_postcss = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
34802
35085
|
init__polyfill_node_process();
|
|
34803
35086
|
let AtRule = require_at_rule();
|
|
@@ -42435,6 +42718,7 @@ function resolveExt(filename, fs) {
|
|
|
42435
42718
|
const tsConfigCache = createCache();
|
|
42436
42719
|
const tsConfigRefMap = /* @__PURE__ */ new Map();
|
|
42437
42720
|
const extendedConfigCache = /* @__PURE__ */ new Map();
|
|
42721
|
+
const matcherCache = /* @__PURE__ */ new Map();
|
|
42438
42722
|
const fileToScopeCache = createCache();
|
|
42439
42723
|
const fileToGlobalScopeCache = createCache();
|
|
42440
42724
|
/**
|
|
@@ -42448,6 +42732,7 @@ function invalidateTypeCache(filename) {
|
|
|
42448
42732
|
if (filename.endsWith(".json")) {
|
|
42449
42733
|
extendedConfigCache.clear();
|
|
42450
42734
|
tsConfigCache.clear();
|
|
42735
|
+
matcherCache.clear();
|
|
42451
42736
|
}
|
|
42452
42737
|
const affectedConfig = tsConfigRefMap.get(filename);
|
|
42453
42738
|
if (affectedConfig) tsConfigCache.delete(affectedConfig);
|
|
@@ -43227,11 +43512,14 @@ function transformDestructuredProps(ctx, vueImportAliases) {
|
|
|
43227
43512
|
const excludedIds = /* @__PURE__ */ new WeakSet();
|
|
43228
43513
|
const parentStack = [];
|
|
43229
43514
|
const propsLocalToPublicMap = Object.create(null);
|
|
43515
|
+
const modelOptionNodes = /* @__PURE__ */ new Set();
|
|
43516
|
+
let currentModelOption = null;
|
|
43230
43517
|
for (const key in ctx.propsDestructuredBindings) {
|
|
43231
43518
|
const { local } = ctx.propsDestructuredBindings[key];
|
|
43232
43519
|
rootScope[local] = true;
|
|
43233
43520
|
propsLocalToPublicMap[local] = key;
|
|
43234
43521
|
}
|
|
43522
|
+
for (const { runtimeOptionNodes } of Object.values(ctx.modelDecls)) for (const node of runtimeOptionNodes) modelOptionNodes.add(node);
|
|
43235
43523
|
function pushScope(isFunctionScope = false) {
|
|
43236
43524
|
const scope = currentScope = Object.create(currentScope);
|
|
43237
43525
|
scopeStack.push(scope);
|
|
@@ -43272,6 +43560,10 @@ function transformDestructuredProps(ctx, vueImportAliases) {
|
|
|
43272
43560
|
} });
|
|
43273
43561
|
}
|
|
43274
43562
|
function rewriteId(id, parent, parentStack) {
|
|
43563
|
+
if (currentModelOption) {
|
|
43564
|
+
const isDefault = (currentModelOption.type === "ObjectProperty" || currentModelOption.type === "ObjectMethod") && resolveObjectKey(currentModelOption.key, currentModelOption.computed) === "default";
|
|
43565
|
+
ctx.error(`\`${DEFINE_MODEL}()\` prop options cannot reference destructured props because they are hoisted outside of the setup() function.` + (isDefault ? ` Use the props argument of the default factory instead, e.g. default: props => props${genPropsAccessExp(propsLocalToPublicMap[id.name]).slice(`__props`.length)}` : ``), id);
|
|
43566
|
+
}
|
|
43275
43567
|
if (parent.type === "AssignmentExpression" && id === parent.left || parent.type === "UpdateExpression") ctx.error(`Cannot assign to destructured props as they are readonly.`, id);
|
|
43276
43568
|
if (isStaticProperty(parent) && parent.shorthand) {
|
|
43277
43569
|
if (!parent.inPattern || isInDestructureAssignment(parent, parentStack)) ctx.s.appendLeft(id.end + ctx.startOffset, `: ${genPropsAccessExp(propsLocalToPublicMap[id.name])}`);
|
|
@@ -43290,6 +43582,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
|
|
|
43290
43582
|
enter(node, parent) {
|
|
43291
43583
|
parent && parentStack.push(parent);
|
|
43292
43584
|
if (parent && parent.type.startsWith("TS") && !TS_NODE_TYPES.includes(parent.type)) return this.skip();
|
|
43585
|
+
if (modelOptionNodes.has(node)) currentModelOption = node;
|
|
43293
43586
|
checkUsage(node, "watch", vueImportAliases.watch);
|
|
43294
43587
|
checkUsage(node, "toRef", vueImportAliases.toRef);
|
|
43295
43588
|
if (isFunctionType(node)) {
|
|
@@ -43327,6 +43620,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
|
|
|
43327
43620
|
},
|
|
43328
43621
|
leave(node, parent) {
|
|
43329
43622
|
parent && parentStack.pop();
|
|
43623
|
+
if (node === currentModelOption) currentModelOption = null;
|
|
43330
43624
|
if (isFunctionType(node)) popScope(true);
|
|
43331
43625
|
else if (node.type === "BlockStatement" && !isFunctionType(parent)) popScope();
|
|
43332
43626
|
else if (node.type === "CatchClause" || node.type === "ForOfStatement" || node.type === "ForInStatement" || node.type === "ForStatement") popScope();
|
|
@@ -43521,6 +43815,7 @@ function compileScript(sfc, options) {
|
|
|
43521
43815
|
if (script && scriptSetup && scriptLang !== scriptSetupLang) throw new Error("[@vue/compiler-sfc] <script> and <script setup> must have the same language type.");
|
|
43522
43816
|
if (!scriptSetup) {
|
|
43523
43817
|
if (!script) throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
|
|
43818
|
+
if (vapor) throw new Error(`[@vue/compiler-sfc] Vapor components with a normal <script> must also include <script setup>, <script vapor>, or <script setup vapor>.`);
|
|
43524
43819
|
if (script.lang && !isJSOrTS) return script;
|
|
43525
43820
|
return processNormalScript(new ScriptCompileContext(sfc, options), scopeId);
|
|
43526
43821
|
}
|
|
@@ -43872,7 +44167,7 @@ function compileScript(sfc, options) {
|
|
|
43872
44167
|
if (cssModuleBindings.length) returned = `{\n${cssModuleBindings.join("\n")}\n${returned}\n}`;
|
|
43873
44168
|
} else returned = `() => {}`;
|
|
43874
44169
|
if (!inlineMode && true) ctx.s.appendRight(endOffset, `\nconst __returned__ = ${returned}\nObject.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\nreturn __returned__\n}\n\n`);
|
|
43875
|
-
else ctx.s.appendRight(endOffset, `\n${vapor && !ssr && inlineMode ? `` : `return `}${returned}\n}\n\n`);
|
|
44170
|
+
else ctx.s.appendRight(endOffset, `\n${vapor && !ssr && inlineMode && !(!sfc.template && ctx.hasDefaultExportRender) ? `` : `return `}${returned}\n}\n\n`);
|
|
43876
44171
|
const genDefaultAs = options.genDefaultAs ? `const ${options.genDefaultAs} =` : `export default`;
|
|
43877
44172
|
let runtimeOptions = ``;
|
|
43878
44173
|
if (!ctx.hasDefaultExportName && filename && filename !== "anonymous.vue") {
|
|
@@ -44047,7 +44342,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
44047
44342
|
//#endregion
|
|
44048
44343
|
//#region packages/compiler-sfc/src/index.ts
|
|
44049
44344
|
init_objectSpread2();
|
|
44050
|
-
const version = "3.6.0-rc.
|
|
44345
|
+
const version = "3.6.0-rc.12";
|
|
44051
44346
|
const parseCache = parseCache$1;
|
|
44052
44347
|
const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
|
|
44053
44348
|
const walk = walk$2;
|