@vue/compiler-sfc 3.6.0-rc.1 → 3.6.0-rc.3
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 +152 -85
- package/dist/compiler-sfc.d.ts +412 -291
- package/dist/compiler-sfc.esm-browser.js +385 -255
- 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.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -388,7 +388,7 @@ const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS);
|
|
|
388
388
|
/**
|
|
389
389
|
* The full list is needed during SSR to produce the correct initial markup.
|
|
390
390
|
*/
|
|
391
|
-
const isBooleanAttr = /* @__PURE__ */ makeMap("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly,async,autofocus,autoplay,controls,default,defer,disabled,
|
|
391
|
+
const isBooleanAttr = /* @__PURE__ */ makeMap("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
|
|
392
392
|
/**
|
|
393
393
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
394
394
|
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
@@ -3607,7 +3607,7 @@ const errorMessages$1 = {
|
|
|
3607
3607
|
[54]: ``
|
|
3608
3608
|
};
|
|
3609
3609
|
//#endregion
|
|
3610
|
-
//#region node_modules/.pnpm/@babel+parser@7.29.
|
|
3610
|
+
//#region node_modules/.pnpm/@babel+parser@7.29.8/node_modules/@babel/parser/lib/index.js
|
|
3611
3611
|
var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3612
3612
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3613
3613
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
@@ -3794,6 +3794,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3794
3794
|
SloppyFunctionAnnexB: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",
|
|
3795
3795
|
SourcePhaseImportRequiresDefault: "Only `import source x from \"./module\"` is valid.",
|
|
3796
3796
|
StaticPrototype: "Classes may not have static property named prototype.",
|
|
3797
|
+
SuperCallNotNewExpression: "Cannot use new with super(...).",
|
|
3797
3798
|
SuperNotAllowed: "`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",
|
|
3798
3799
|
SuperPrivateField: "Private fields can't be accessed on super.",
|
|
3799
3800
|
TrailingDecorator: "Decorators must be attached to a class element.",
|
|
@@ -3816,7 +3817,6 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3816
3817
|
UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
|
|
3817
3818
|
UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
|
|
3818
3819
|
UnexpectedVoidPattern: "Unexpected void binding.",
|
|
3819
|
-
UnsupportedBind: "Binding should be performed on object property.",
|
|
3820
3820
|
UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
|
|
3821
3821
|
UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
|
|
3822
3822
|
UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.",
|
|
@@ -3872,6 +3872,10 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3872
3872
|
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
|
3873
3873
|
PrimaryTopicRequiresSmartPipeline: "Topic reference is used, but the pipelineOperator plugin was not passed a \"proposal\": \"hack\" or \"smart\" option."
|
|
3874
3874
|
});
|
|
3875
|
+
var FunctionBindErrors = {
|
|
3876
|
+
UnsupportedBind: "Binding should be performed on object property.",
|
|
3877
|
+
UnsupportedBindRHS: "The right-hand side of binding can not be super or import."
|
|
3878
|
+
};
|
|
3875
3879
|
const _excluded = ["message"];
|
|
3876
3880
|
function defineHidden(obj, key, value) {
|
|
3877
3881
|
Object.defineProperty(obj, key, {
|
|
@@ -3936,7 +3940,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3936
3940
|
}
|
|
3937
3941
|
return ParseErrorConstructors;
|
|
3938
3942
|
}
|
|
3939
|
-
const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(ParseExpressionErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
|
|
3943
|
+
const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(ParseExpressionErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors), ParseErrorEnum`functionBind`(FunctionBindErrors));
|
|
3940
3944
|
function createDefaultOptions() {
|
|
3941
3945
|
return {
|
|
3942
3946
|
sourceType: "script",
|
|
@@ -13511,7 +13515,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13511
13515
|
}
|
|
13512
13516
|
parseSubscript(base, startLoc, noCalls, state) {
|
|
13513
13517
|
const { type } = this.state;
|
|
13514
|
-
if (!noCalls && type === 15) return this.parseBind(base, startLoc,
|
|
13518
|
+
if (!noCalls && type === 15) return this.parseBind(base, startLoc, state);
|
|
13515
13519
|
else if (tokenIsTemplate(type)) return this.parseTaggedTemplateExpression(base, startLoc, state);
|
|
13516
13520
|
let optional = false;
|
|
13517
13521
|
if (type === 18) {
|
|
@@ -13550,13 +13554,16 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13550
13554
|
return this.finishNode(node, "OptionalMemberExpression");
|
|
13551
13555
|
} else return this.finishNode(node, "MemberExpression");
|
|
13552
13556
|
}
|
|
13553
|
-
parseBind(base, startLoc,
|
|
13557
|
+
parseBind(base, startLoc, state) {
|
|
13554
13558
|
const node = this.startNodeAt(startLoc);
|
|
13555
13559
|
node.object = base;
|
|
13556
13560
|
this.next();
|
|
13557
|
-
|
|
13561
|
+
const isImport = this.match(83);
|
|
13562
|
+
const callee = this.parseNoCallExpr();
|
|
13563
|
+
if (callee.type === "Super" || isImport && callee.type === "ImportExpression" || callee.type === "Import") throw this.raise(Errors.UnsupportedBindRHS, callee);
|
|
13564
|
+
node.callee = callee;
|
|
13558
13565
|
state.stop = true;
|
|
13559
|
-
return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc,
|
|
13566
|
+
return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc, false);
|
|
13560
13567
|
}
|
|
13561
13568
|
parseCoverCallAndAsyncArrowHead(base, startLoc, state, optional) {
|
|
13562
13569
|
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
|
@@ -14013,7 +14020,8 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
14013
14020
|
const isImport = this.match(83);
|
|
14014
14021
|
const callee = this.parseNoCallExpr();
|
|
14015
14022
|
node.callee = callee;
|
|
14016
|
-
if (isImport &&
|
|
14023
|
+
if (isImport && callee.type === "ImportExpression" || callee.type === "Import") this.raise(Errors.ImportCallNotNewExpression, callee);
|
|
14024
|
+
if (callee.type === "Super") this.raise(Errors.SuperCallNotNewExpression, callee);
|
|
14017
14025
|
}
|
|
14018
14026
|
parseTemplateElement(isTagged) {
|
|
14019
14027
|
const { start, startLoc, end, value } = this.state;
|
|
@@ -17630,7 +17638,7 @@ function getSelfName(filename) {
|
|
|
17630
17638
|
const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
|
|
17631
17639
|
return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
|
|
17632
17640
|
}
|
|
17633
|
-
function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false,
|
|
17641
|
+
function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
|
|
17634
17642
|
const context = {
|
|
17635
17643
|
filename,
|
|
17636
17644
|
selfName: getSelfName(filename),
|
|
@@ -17652,7 +17660,6 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
17652
17660
|
bindingMetadata,
|
|
17653
17661
|
inline,
|
|
17654
17662
|
isTS,
|
|
17655
|
-
eventDelegation,
|
|
17656
17663
|
onError,
|
|
17657
17664
|
onWarn,
|
|
17658
17665
|
compatConfig,
|
|
@@ -20819,15 +20826,22 @@ const transformFor = createStructuralDirectiveTransform$1("for", (node, dir, con
|
|
|
20819
20826
|
else {
|
|
20820
20827
|
childBlock = children[0].codegenNode;
|
|
20821
20828
|
if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
|
|
20822
|
-
|
|
20829
|
+
const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
|
|
20830
|
+
if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
|
|
20823
20831
|
removeHelper(OPEN_BLOCK);
|
|
20824
20832
|
removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
20825
20833
|
} else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
20826
|
-
childBlock.isBlock =
|
|
20834
|
+
childBlock.isBlock = shouldUseBlock;
|
|
20827
20835
|
if (childBlock.isBlock) {
|
|
20828
20836
|
helper(OPEN_BLOCK);
|
|
20829
20837
|
helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
20830
|
-
} else
|
|
20838
|
+
} else {
|
|
20839
|
+
helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
20840
|
+
if (childBlock.needsPatch) {
|
|
20841
|
+
var _childBlock$patchFlag;
|
|
20842
|
+
childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
|
|
20843
|
+
}
|
|
20844
|
+
}
|
|
20831
20845
|
}
|
|
20832
20846
|
if (memo) {
|
|
20833
20847
|
const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
|
|
@@ -21083,12 +21097,16 @@ const transformElement$1 = (node, context) => {
|
|
|
21083
21097
|
let vnodeDynamicProps;
|
|
21084
21098
|
let dynamicPropNames;
|
|
21085
21099
|
let vnodeDirectives;
|
|
21100
|
+
let needsPatch = false;
|
|
21101
|
+
let isBlockRequired = false;
|
|
21086
21102
|
let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
|
|
21087
21103
|
if (props.length > 0) {
|
|
21088
21104
|
const propsBuildResult = buildProps$1(node, context, void 0, isComponent, isDynamicComponent);
|
|
21089
21105
|
vnodeProps = propsBuildResult.props;
|
|
21090
21106
|
patchFlag = propsBuildResult.patchFlag;
|
|
21091
21107
|
dynamicPropNames = propsBuildResult.dynamicPropNames;
|
|
21108
|
+
needsPatch = propsBuildResult.needsPatch;
|
|
21109
|
+
isBlockRequired = propsBuildResult.isBlockRequired;
|
|
21092
21110
|
const directives = propsBuildResult.directives;
|
|
21093
21111
|
vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
|
|
21094
21112
|
if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
|
|
@@ -21117,7 +21135,10 @@ const transformElement$1 = (node, context) => {
|
|
|
21117
21135
|
} else vnodeChildren = node.children;
|
|
21118
21136
|
}
|
|
21119
21137
|
if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
21120
|
-
node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
21138
|
+
const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
21139
|
+
needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
|
|
21140
|
+
if (needsPatch) vnodeCall.needsPatch = true;
|
|
21141
|
+
if (isBlockRequired) vnodeCall.isBlockRequired = true;
|
|
21121
21142
|
};
|
|
21122
21143
|
};
|
|
21123
21144
|
function resolveComponentType(node, context, ssr = false) {
|
|
@@ -21202,6 +21223,7 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
|
|
|
21202
21223
|
const runtimeDirectives = [];
|
|
21203
21224
|
const hasChildren = children.length > 0;
|
|
21204
21225
|
let shouldUseBlock = false;
|
|
21226
|
+
let isBlockRequired = false;
|
|
21205
21227
|
let patchFlag = 0;
|
|
21206
21228
|
let hasRef = false;
|
|
21207
21229
|
let hasClassBinding = false;
|
|
@@ -21226,12 +21248,12 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
|
|
|
21226
21248
|
const isEventHandler = isOn(name);
|
|
21227
21249
|
if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp$1(name)) hasHydrationEventBinding = true;
|
|
21228
21250
|
if (isEventHandler && isReservedProp$1(name)) hasVnodeHook = true;
|
|
21251
|
+
if (name === "ref") hasRef = true;
|
|
21229
21252
|
if (isEventHandler && value.type === 14) value = value.arguments[0];
|
|
21230
21253
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
|
|
21231
|
-
if (name === "
|
|
21232
|
-
else if (name === "class") hasClassBinding = true;
|
|
21254
|
+
if (name === "class") hasClassBinding = true;
|
|
21233
21255
|
else if (name === "style") hasStyleBinding = true;
|
|
21234
|
-
else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
21256
|
+
else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
21235
21257
|
if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
21236
21258
|
} else hasDynamicKeys = true;
|
|
21237
21259
|
};
|
|
@@ -21264,7 +21286,11 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
|
|
|
21264
21286
|
if (name === "once" || name === "memo") continue;
|
|
21265
21287
|
if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag$1(tag) || false)) continue;
|
|
21266
21288
|
if (isVOn && ssr) continue;
|
|
21267
|
-
if (isVBind && isStaticArgOf(arg, "key")
|
|
21289
|
+
if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
|
|
21290
|
+
if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
|
|
21291
|
+
shouldUseBlock = true;
|
|
21292
|
+
isBlockRequired = true;
|
|
21293
|
+
}
|
|
21268
21294
|
if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
|
|
21269
21295
|
if (!arg && (isVBind || isVOn)) {
|
|
21270
21296
|
hasDynamicKeys = true;
|
|
@@ -21294,7 +21320,10 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
|
|
|
21294
21320
|
}
|
|
21295
21321
|
} else if (!isBuiltInDirective(name)) {
|
|
21296
21322
|
runtimeDirectives.push(prop);
|
|
21297
|
-
if (hasChildren)
|
|
21323
|
+
if (hasChildren) {
|
|
21324
|
+
shouldUseBlock = true;
|
|
21325
|
+
isBlockRequired = true;
|
|
21326
|
+
}
|
|
21298
21327
|
}
|
|
21299
21328
|
}
|
|
21300
21329
|
}
|
|
@@ -21311,7 +21340,8 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
|
|
|
21311
21340
|
if (dynamicPropNames.length) patchFlag |= 8;
|
|
21312
21341
|
if (hasHydrationEventBinding) patchFlag |= 32;
|
|
21313
21342
|
}
|
|
21314
|
-
|
|
21343
|
+
const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
|
|
21344
|
+
if (!shouldUseBlock && needsPatch) patchFlag |= 512;
|
|
21315
21345
|
if (!context.inSSR && propsExpression) switch (propsExpression.type) {
|
|
21316
21346
|
case 15:
|
|
21317
21347
|
let classKeyIndex = -1;
|
|
@@ -21341,7 +21371,9 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
|
|
|
21341
21371
|
directives: runtimeDirectives,
|
|
21342
21372
|
patchFlag,
|
|
21343
21373
|
dynamicPropNames,
|
|
21344
|
-
shouldUseBlock
|
|
21374
|
+
shouldUseBlock,
|
|
21375
|
+
needsPatch,
|
|
21376
|
+
isBlockRequired
|
|
21345
21377
|
};
|
|
21346
21378
|
}
|
|
21347
21379
|
function dedupeProperties$1(properties) {
|
|
@@ -21966,6 +21998,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
21966
21998
|
const eventOptionModifiers = [];
|
|
21967
21999
|
for (let i = 0; i < modifiers.length; i++) {
|
|
21968
22000
|
const modifier = modifiers[i].content;
|
|
22001
|
+
if (modifier === "delegate") {
|
|
22002
|
+
if (context) {
|
|
22003
|
+
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
|
|
22004
|
+
error.loc = modifiers[i].loc;
|
|
22005
|
+
context.onWarn(error);
|
|
22006
|
+
}
|
|
22007
|
+
continue;
|
|
22008
|
+
}
|
|
21969
22009
|
if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
|
|
21970
22010
|
else {
|
|
21971
22011
|
const keyString = isString$1(key) ? key : isStaticExp(key) ? key.content : null;
|
|
@@ -22216,10 +22256,11 @@ function stringifyElement(node, context) {
|
|
|
22216
22256
|
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
|
22217
22257
|
continue;
|
|
22218
22258
|
}
|
|
22219
|
-
if (isBooleanAttr(p.arg.content) && exp.content === "false") continue;
|
|
22259
|
+
if ((isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
|
|
22220
22260
|
let evaluated = evaluateConstant(exp);
|
|
22221
22261
|
if (evaluated != null) {
|
|
22222
22262
|
const arg = p.arg && p.arg.content;
|
|
22263
|
+
if (arg === "hidden" && typeof evaluated === "number" && !includeBooleanAttr(evaluated)) continue;
|
|
22223
22264
|
if (arg === "class") evaluated = normalizeClass(evaluated);
|
|
22224
22265
|
else if (arg === "style") evaluated = stringifyStyle(normalizeStyle(evaluated));
|
|
22225
22266
|
res += ` ${p.arg.content}="${escapeHtml(evaluated)}"`;
|
|
@@ -22973,6 +23014,16 @@ function createCache(max = 500) {
|
|
|
22973
23014
|
return /* @__PURE__ */ new Map();
|
|
22974
23015
|
}
|
|
22975
23016
|
//#endregion
|
|
23017
|
+
//#region packages/compiler-sfc/src/template/resolveTemplateAST.ts
|
|
23018
|
+
function resolveTemplateAST(inAST, options) {
|
|
23019
|
+
if (!(inAST === null || inAST === void 0 ? void 0 : inAST.transformed)) return inAST;
|
|
23020
|
+
const { compiler = src_exports$2, compilerOptions, ssr, onError } = options;
|
|
23021
|
+
return createRoot((ssr ? src_exports$2 : compiler).parse(inAST.source, _objectSpread2(_objectSpread2({ prefixIdentifiers: true }, compilerOptions), {}, {
|
|
23022
|
+
parseMode: "sfc",
|
|
23023
|
+
onError
|
|
23024
|
+
})).children.find((node) => node.type === 1 && node.tag === "template").children, inAST.source);
|
|
23025
|
+
}
|
|
23026
|
+
//#endregion
|
|
22976
23027
|
//#region packages/compiler-sfc/src/script/importUsageCheck.ts
|
|
22977
23028
|
/**
|
|
22978
23029
|
* Check if an identifier is used in the SFC's template.
|
|
@@ -22980,23 +23031,28 @@ function createCache(max = 500) {
|
|
|
22980
23031
|
* when not using inline mode.
|
|
22981
23032
|
* - 2.check whether the built-in properties such as $attrs, $slots, $emit are used in the template
|
|
22982
23033
|
*/
|
|
22983
|
-
function isUsedInTemplate(identifier, sfc) {
|
|
22984
|
-
return resolveTemplateUsedIdentifiers(sfc).has(identifier);
|
|
23034
|
+
function isUsedInTemplate(identifier, sfc, options) {
|
|
23035
|
+
return resolveTemplateUsedIdentifiers(sfc, options).has(identifier);
|
|
22985
23036
|
}
|
|
22986
23037
|
const templateAnalysisCache = createCache();
|
|
22987
|
-
function resolveTemplateVModelIdentifiers(sfc) {
|
|
22988
|
-
return resolveTemplateAnalysisResult(sfc, false).vModelIds;
|
|
23038
|
+
function resolveTemplateVModelIdentifiers(sfc, options) {
|
|
23039
|
+
return resolveTemplateAnalysisResult(sfc, false, options).vModelIds;
|
|
22989
23040
|
}
|
|
22990
|
-
function resolveTemplateUsedIdentifiers(sfc) {
|
|
22991
|
-
return resolveTemplateAnalysisResult(sfc).usedIds;
|
|
23041
|
+
function resolveTemplateUsedIdentifiers(sfc, options) {
|
|
23042
|
+
return resolveTemplateAnalysisResult(sfc, true, options).usedIds;
|
|
22992
23043
|
}
|
|
22993
|
-
function resolveTemplateAnalysisResult(sfc, collectUsedIds = true) {
|
|
23044
|
+
function resolveTemplateAnalysisResult(sfc, collectUsedIds = true, options) {
|
|
22994
23045
|
const { content, ast } = sfc.template;
|
|
22995
23046
|
const cached = templateAnalysisCache.get(content);
|
|
22996
23047
|
if (cached && (!collectUsedIds || cached.usedIds)) return cached;
|
|
22997
23048
|
const ids = collectUsedIds ? /* @__PURE__ */ new Set() : void 0;
|
|
22998
23049
|
const vModelIds = /* @__PURE__ */ new Set();
|
|
22999
|
-
ast
|
|
23050
|
+
resolveTemplateAST(ast, {
|
|
23051
|
+
compiler: options === null || options === void 0 ? void 0 : options.compiler,
|
|
23052
|
+
compilerOptions: options === null || options === void 0 ? void 0 : options.compilerOptions,
|
|
23053
|
+
ssr: options === null || options === void 0 ? void 0 : options.ssr,
|
|
23054
|
+
onError: () => {}
|
|
23055
|
+
}).children.forEach(walk);
|
|
23000
23056
|
function walk(node) {
|
|
23001
23057
|
switch (node.type) {
|
|
23002
23058
|
case 1:
|
|
@@ -23051,6 +23107,7 @@ function extractIdentifiers$1(ids, node) {
|
|
|
23051
23107
|
}
|
|
23052
23108
|
//#endregion
|
|
23053
23109
|
//#region packages/compiler-sfc/src/parse.ts
|
|
23110
|
+
init_objectSpread2();
|
|
23054
23111
|
const DEFAULT_FILENAME = "anonymous.vue";
|
|
23055
23112
|
const parseCache$1 = createCache();
|
|
23056
23113
|
function parse(source, options = {}) {
|
|
@@ -24749,22 +24806,20 @@ const IRNodeTypes = {
|
|
|
24749
24806
|
"9": "SET_TEMPLATE_REF",
|
|
24750
24807
|
"INSERT_NODE": 10,
|
|
24751
24808
|
"10": "INSERT_NODE",
|
|
24752
|
-
"
|
|
24753
|
-
"11": "
|
|
24754
|
-
"
|
|
24755
|
-
"12": "
|
|
24756
|
-
"
|
|
24757
|
-
"13": "
|
|
24758
|
-
"
|
|
24759
|
-
"14": "
|
|
24760
|
-
"
|
|
24761
|
-
"15": "
|
|
24762
|
-
"
|
|
24763
|
-
"16": "
|
|
24764
|
-
"
|
|
24765
|
-
"17": "
|
|
24766
|
-
"GET_TEXT_CHILD": 18,
|
|
24767
|
-
"18": "GET_TEXT_CHILD"
|
|
24809
|
+
"CREATE_COMPONENT_NODE": 11,
|
|
24810
|
+
"11": "CREATE_COMPONENT_NODE",
|
|
24811
|
+
"SLOT_OUTLET_NODE": 12,
|
|
24812
|
+
"12": "SLOT_OUTLET_NODE",
|
|
24813
|
+
"DIRECTIVE": 13,
|
|
24814
|
+
"13": "DIRECTIVE",
|
|
24815
|
+
"IF": 14,
|
|
24816
|
+
"14": "IF",
|
|
24817
|
+
"FOR": 15,
|
|
24818
|
+
"15": "FOR",
|
|
24819
|
+
"KEY": 16,
|
|
24820
|
+
"16": "KEY",
|
|
24821
|
+
"GET_TEXT_CHILD": 17,
|
|
24822
|
+
"17": "GET_TEXT_CHILD"
|
|
24768
24823
|
};
|
|
24769
24824
|
var TemplateRegistry = class {
|
|
24770
24825
|
constructor() {
|
|
@@ -24786,7 +24841,7 @@ const DynamicFlag = {
|
|
|
24786
24841
|
};
|
|
24787
24842
|
function isBlockOperation(op) {
|
|
24788
24843
|
const type = op.type;
|
|
24789
|
-
return type ===
|
|
24844
|
+
return type === 11 || type === 12 || type === 14 || type === 16 || type === 15;
|
|
24790
24845
|
}
|
|
24791
24846
|
//#endregion
|
|
24792
24847
|
//#region packages/compiler-vapor/src/transforms/utils.ts
|
|
@@ -25176,7 +25231,6 @@ const defaultOptions = {
|
|
|
25176
25231
|
bindingMetadata: EMPTY_OBJ,
|
|
25177
25232
|
inline: false,
|
|
25178
25233
|
isTS: false,
|
|
25179
|
-
eventDelegation: true,
|
|
25180
25234
|
onError: defaultOnError,
|
|
25181
25235
|
onWarn: defaultOnWarn
|
|
25182
25236
|
};
|
|
@@ -25408,9 +25462,6 @@ function genInsertNode({ parent, elements, anchor }, { helper }) {
|
|
|
25408
25462
|
if (elements.length > 1) element = `[${element}]`;
|
|
25409
25463
|
return [NEWLINE, ...genCall(helper("insert"), element, `n${parent}`, anchor === void 0 ? void 0 : `n${anchor}`)];
|
|
25410
25464
|
}
|
|
25411
|
-
function genPrependNode(oper, { helper }) {
|
|
25412
|
-
return [NEWLINE, ...genCall(helper("prepend"), `n${oper.parent}`, ...oper.elements.map((el) => `n${el}`))];
|
|
25413
|
-
}
|
|
25414
25465
|
//#endregion
|
|
25415
25466
|
//#region packages/compiler-vapor/src/generators/expression.ts
|
|
25416
25467
|
init_objectSpread2();
|
|
@@ -25855,16 +25906,14 @@ function genDeclarations(declarations, context, shouldDeclare) {
|
|
|
25855
25906
|
const varNames = /* @__PURE__ */ new Set();
|
|
25856
25907
|
declarations.forEach(({ name, isIdentifier, value }) => {
|
|
25857
25908
|
if (isIdentifier) {
|
|
25858
|
-
const varName = ids[name] = `_${name}
|
|
25859
|
-
varNames.add(varName);
|
|
25909
|
+
const varName = ids[name] = context.getUniqueLocalName(`_${name}`, varNames);
|
|
25860
25910
|
if (shouldDeclare) push(`const `);
|
|
25861
25911
|
push(`${varName} = `, ...genExpression(value, context), NEWLINE);
|
|
25862
25912
|
}
|
|
25863
25913
|
});
|
|
25864
25914
|
declarations.forEach(({ name, isIdentifier, value }) => {
|
|
25865
25915
|
if (!isIdentifier) {
|
|
25866
|
-
const varName = `_${name}
|
|
25867
|
-
varNames.add(varName);
|
|
25916
|
+
const varName = context.getUniqueLocalName(`_${name}`, varNames);
|
|
25868
25917
|
if (shouldDeclare) push(`const `);
|
|
25869
25918
|
push(`${varName} = `, ...context.withId(() => genExpression(value, context), ids), NEWLINE);
|
|
25870
25919
|
ids[name] = varName;
|
|
@@ -25902,7 +25951,10 @@ function extractMemberExpression(exp, onIdentifier) {
|
|
|
25902
25951
|
case "CallExpression": return `${extractMemberExpression(exp.callee, onIdentifier)}(${exp.arguments.map((arg) => extractMemberExpression(arg, onIdentifier)).join(", ")})`;
|
|
25903
25952
|
case "OptionalCallExpression": return `${extractMemberExpression(exp.callee, onIdentifier)}?.(${exp.arguments.map((arg) => extractMemberExpression(arg, onIdentifier)).join(", ")})`;
|
|
25904
25953
|
case "MemberExpression":
|
|
25905
|
-
case "OptionalMemberExpression":
|
|
25954
|
+
case "OptionalMemberExpression":
|
|
25955
|
+
const object = extractMemberExpression(exp.object, onIdentifier);
|
|
25956
|
+
const optional = exp.type === "OptionalMemberExpression" && exp.optional;
|
|
25957
|
+
return `${object}${exp.computed ? `${optional ? "?." : ""}[${extractMemberExpression(exp.property, onIdentifier)}]` : `${optional ? "?." : "."}${extractMemberExpression(exp.property, NOOP)}`}`;
|
|
25906
25958
|
case "TSNonNullExpression": return `${extractMemberExpression(exp.expression, onIdentifier)}`;
|
|
25907
25959
|
default: return "";
|
|
25908
25960
|
}
|
|
@@ -26162,7 +26214,7 @@ function isFragmentBlock(block) {
|
|
|
26162
26214
|
const child = getSingleReturnedChild(block);
|
|
26163
26215
|
const operation = child && child.operation;
|
|
26164
26216
|
if (!operation) return false;
|
|
26165
|
-
return operation.type ===
|
|
26217
|
+
return operation.type === 12 || operation.type === 15 || operation.type === 16 || operation.type === 14 && !operation.once || operation.type === 11 && !!operation.dynamic && !operation.dynamic.isStatic;
|
|
26166
26218
|
}
|
|
26167
26219
|
function getSingleReturnedChild(block) {
|
|
26168
26220
|
if (block.returns.length !== 1) return;
|
|
@@ -26341,8 +26393,8 @@ function isKeyOnlyBinding(expr, key, source) {
|
|
|
26341
26393
|
//#region packages/compiler-vapor/src/generators/html.ts
|
|
26342
26394
|
function genSetHtml(oper, context) {
|
|
26343
26395
|
const { helper } = context;
|
|
26344
|
-
const { value, element
|
|
26345
|
-
return [NEWLINE, ...genCall(
|
|
26396
|
+
const { value, element } = oper;
|
|
26397
|
+
return [NEWLINE, ...genCall(helper("setHtml"), `n${element}`, genExpression(value, context))];
|
|
26346
26398
|
}
|
|
26347
26399
|
//#endregion
|
|
26348
26400
|
//#region packages/compiler-vapor/src/generators/if.ts
|
|
@@ -26644,9 +26696,9 @@ function genRefValue(value, context) {
|
|
|
26644
26696
|
//#region packages/compiler-vapor/src/generators/text.ts
|
|
26645
26697
|
function genSetText(oper, context) {
|
|
26646
26698
|
const { helper } = context;
|
|
26647
|
-
const { element, values, generated
|
|
26699
|
+
const { element, values, generated } = oper;
|
|
26648
26700
|
const texts = combineValues(values, context);
|
|
26649
|
-
return [NEWLINE, ...genCall(
|
|
26701
|
+
return [NEWLINE, ...genCall(helper("setText"), `${generated ? "x" : "n"}${element}`, texts)];
|
|
26650
26702
|
}
|
|
26651
26703
|
function combineValues(values, context) {
|
|
26652
26704
|
return values.flatMap((value, i) => {
|
|
@@ -26721,7 +26773,11 @@ function genCustomDirectives(opers, context) {
|
|
|
26721
26773
|
return [NEWLINE, ...genCall(helper("withVaporDirectives"), element, directives)];
|
|
26722
26774
|
function genDirectiveItem({ dir, name, asset }) {
|
|
26723
26775
|
const directiveVar = asset ? toValidAssetId(name, "directive") : genExpression(extend(createSimpleExpression(name, false), { ast: null }), context);
|
|
26724
|
-
const value = dir.exp && [
|
|
26776
|
+
const value = dir.exp && [
|
|
26777
|
+
"() => (",
|
|
26778
|
+
...genExpression(dir.exp, context),
|
|
26779
|
+
")"
|
|
26780
|
+
];
|
|
26725
26781
|
const argument = dir.arg && genExpression(dir.arg, context);
|
|
26726
26782
|
const modifiers = !!dir.modifiers.length && [
|
|
26727
26783
|
"{ ",
|
|
@@ -26732,7 +26788,7 @@ function genCustomDirectives(opers, context) {
|
|
|
26732
26788
|
}
|
|
26733
26789
|
}
|
|
26734
26790
|
function filterCustomDirectives(id, operations) {
|
|
26735
|
-
return operations.filter((oper) => oper.type ===
|
|
26791
|
+
return operations.filter((oper) => oper.type === 13 && oper.element === id && !oper.builtin);
|
|
26736
26792
|
}
|
|
26737
26793
|
//#endregion
|
|
26738
26794
|
//#region packages/compiler-vapor/src/generators/component.ts
|
|
@@ -26965,7 +27021,8 @@ function genDynamicProps(props, context, directStaticLiteralProps = false) {
|
|
|
26965
27021
|
if (frags.length) return genMulti(DELIMITERS_ARRAY_NEWLINE, ...frags);
|
|
26966
27022
|
}
|
|
26967
27023
|
function genProp(prop, context, isStatic, wrapHandler = true, directStaticLiteral = false) {
|
|
26968
|
-
|
|
27024
|
+
let values = genPropValue(prop.values, context);
|
|
27025
|
+
if (prop.toDisplayString) values = genCall(context.helper("toDisplayString"), values);
|
|
26969
27026
|
return [
|
|
26970
27027
|
...genPropKey(prop, context),
|
|
26971
27028
|
": ",
|
|
@@ -27119,7 +27176,7 @@ function genSlotBlockWithProps(oper, context, emitNonStableFlag = true) {
|
|
|
27119
27176
|
if (propsName) idMap[propsName] = null;
|
|
27120
27177
|
const exitSlotBlock = context.enterSlotBlock();
|
|
27121
27178
|
const hasStableRoot = hasStableSlotRoot(oper, context);
|
|
27122
|
-
if (!hasStableRoot) markSlotRootOperations(oper);
|
|
27179
|
+
if (!hasStableRoot) markSlotRootOperations(oper, context);
|
|
27123
27180
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
27124
27181
|
if (emitNonStableFlag && !hasStableRoot) blockFn = genCall(context.helper("extend"), blockFn, [`{ _: ${genSlotFlags$1(8)} }`]);
|
|
27125
27182
|
exitSlotBlock();
|
|
@@ -27134,40 +27191,6 @@ function genSlotFlags$1(flags) {
|
|
|
27134
27191
|
if (flags & 8) names.push("NON_STABLE");
|
|
27135
27192
|
return `${flags} /* ${names.join(", ")} */`;
|
|
27136
27193
|
}
|
|
27137
|
-
const commentOnlyTemplateRE = /^(?:<!--[\s\S]*?-->)+$/;
|
|
27138
|
-
function hasStableSlotRoot(block, context) {
|
|
27139
|
-
let hasValidRoot = false;
|
|
27140
|
-
for (let i = 0; i < block.returns.length; i++) {
|
|
27141
|
-
const id = block.returns[i];
|
|
27142
|
-
const child = findReturnedDynamic$1(block, id);
|
|
27143
|
-
const operation = child && child.operation;
|
|
27144
|
-
if (!operation) {
|
|
27145
|
-
if (child && isStableTemplateSlotRoot(child, context)) hasValidRoot = true;
|
|
27146
|
-
continue;
|
|
27147
|
-
}
|
|
27148
|
-
switch (operation.type) {
|
|
27149
|
-
case 12:
|
|
27150
|
-
if (!operation.dynamic || operation.dynamic.isStatic) {
|
|
27151
|
-
hasValidRoot = true;
|
|
27152
|
-
continue;
|
|
27153
|
-
}
|
|
27154
|
-
continue;
|
|
27155
|
-
case 17:
|
|
27156
|
-
if (hasStableSlotRoot(operation.block, context)) {
|
|
27157
|
-
hasValidRoot = true;
|
|
27158
|
-
continue;
|
|
27159
|
-
}
|
|
27160
|
-
continue;
|
|
27161
|
-
default: continue;
|
|
27162
|
-
}
|
|
27163
|
-
}
|
|
27164
|
-
return hasValidRoot;
|
|
27165
|
-
}
|
|
27166
|
-
function isStableTemplateSlotRoot(child, context) {
|
|
27167
|
-
if (child.template == null) return false;
|
|
27168
|
-
const content = context.ir.template.entries[child.template].content;
|
|
27169
|
-
return content !== "" && !commentOnlyTemplateRE.test(content.trim());
|
|
27170
|
-
}
|
|
27171
27194
|
//#endregion
|
|
27172
27195
|
//#region packages/compiler-vapor/src/generators/slotOutlet.ts
|
|
27173
27196
|
function genSlotOutlet(oper, context) {
|
|
@@ -27176,7 +27199,7 @@ function genSlotOutlet(oper, context) {
|
|
|
27176
27199
|
const [frag, push] = buildCodeFragment();
|
|
27177
27200
|
let fallbackArg;
|
|
27178
27201
|
if (fallback) {
|
|
27179
|
-
if (context.inSlotBlock) markSlotRootOperations(fallback);
|
|
27202
|
+
if (context.inSlotBlock) markSlotRootOperations(fallback, context);
|
|
27180
27203
|
fallbackArg = genBlock(fallback, context);
|
|
27181
27204
|
}
|
|
27182
27205
|
const createSlot = helper("createSlot");
|
|
@@ -27195,19 +27218,21 @@ function genSlotFlags(flags) {
|
|
|
27195
27218
|
if (flags & 1) names.push("NO_SLOTTED");
|
|
27196
27219
|
if (flags & 2) names.push("ONCE");
|
|
27197
27220
|
if (flags & 4) names.push("SLOT_ROOT");
|
|
27221
|
+
if (flags & 16) names.push("SHARED_FALLBACK");
|
|
27222
|
+
if (flags & 32) names.push("INHERIT_FALLBACK");
|
|
27198
27223
|
return `${flags} /* ${names.join(", ")} */`;
|
|
27199
27224
|
}
|
|
27200
27225
|
//#endregion
|
|
27201
27226
|
//#region packages/compiler-vapor/src/generators/key.ts
|
|
27202
27227
|
function genKey(oper, context) {
|
|
27203
|
-
const { id, value, block } = oper;
|
|
27228
|
+
const { id, value, block, slotRoot } = oper;
|
|
27204
27229
|
const [frag, push] = buildCodeFragment();
|
|
27205
27230
|
const blockFn = genBlock(block, context);
|
|
27206
27231
|
push(NEWLINE, `const n${id} = `, ...genCall(context.helper("createKeyedFragment"), [
|
|
27207
27232
|
`() => (`,
|
|
27208
27233
|
...genExpression(value, context),
|
|
27209
27234
|
")"
|
|
27210
|
-
], blockFn));
|
|
27235
|
+
], blockFn, slotRoot ? "true" : false));
|
|
27211
27236
|
return frag;
|
|
27212
27237
|
}
|
|
27213
27238
|
function genSetBlockKey(oper, context) {
|
|
@@ -27237,14 +27262,13 @@ function genOperation(oper, context) {
|
|
|
27237
27262
|
case 8: return genSetHtml(oper, context);
|
|
27238
27263
|
case 9: return genSetTemplateRef(oper, context);
|
|
27239
27264
|
case 10: return genInsertNode(oper, context);
|
|
27240
|
-
case
|
|
27241
|
-
case 15: return
|
|
27242
|
-
case 16: return
|
|
27243
|
-
case
|
|
27244
|
-
case 12: return
|
|
27245
|
-
case 13: return
|
|
27246
|
-
case
|
|
27247
|
-
case 18: return genGetTextChild(oper, context);
|
|
27265
|
+
case 14: return genIf(oper, context);
|
|
27266
|
+
case 15: return genFor(oper, context);
|
|
27267
|
+
case 16: return genKey(oper, context);
|
|
27268
|
+
case 11: return genCreateComponent(oper, context);
|
|
27269
|
+
case 12: return genSlotOutlet(oper, context);
|
|
27270
|
+
case 13: return genBuiltinDirective(oper, context);
|
|
27271
|
+
case 17: return genGetTextChild(oper, context);
|
|
27248
27272
|
default: throw new Error(`Unhandled operation type in genOperation: ${oper}`);
|
|
27249
27273
|
}
|
|
27250
27274
|
}
|
|
@@ -27292,9 +27316,8 @@ function genEffect({ operations }, context) {
|
|
|
27292
27316
|
return frag;
|
|
27293
27317
|
}
|
|
27294
27318
|
function genInsertionState(operation, context) {
|
|
27295
|
-
const { parent, anchor,
|
|
27296
|
-
|
|
27297
|
-
return [NEWLINE, ...genCall(context.helper("setInsertionState"), `n${parent}`, anchor == null ? void 0 : isPrepend ? `0` : append ? "null" : `n${anchor}`, logicalIndex !== void 0 && (!isPrepend || logicalIndex !== 0) ? String(logicalIndex) : void 0)];
|
|
27319
|
+
const { parent, anchor, appendIndex } = operation;
|
|
27320
|
+
return [NEWLINE, ...genCall(context.helper("setInsertionState"), `n${parent}`, anchor != null ? `n${anchor}` : appendIndex ? String(appendIndex) : void 0)];
|
|
27298
27321
|
}
|
|
27299
27322
|
//#endregion
|
|
27300
27323
|
//#region packages/compiler-vapor/src/generators/template.ts
|
|
@@ -27332,6 +27355,16 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flush
|
|
|
27332
27355
|
for (const [index, child] of children.entries()) {
|
|
27333
27356
|
if (child.flags & 2) offset--;
|
|
27334
27357
|
if (child.flags & 4 && child.template != null) {
|
|
27358
|
+
if (child.anchor !== void 0) {
|
|
27359
|
+
const elementIndex = index + offset;
|
|
27360
|
+
const variable = `n${child.anchor}`;
|
|
27361
|
+
pushBlock(NEWLINE, `const ${variable} = `, ...genAccessPath(context, from, elementIndex, prev));
|
|
27362
|
+
prev = [
|
|
27363
|
+
variable,
|
|
27364
|
+
elementIndex,
|
|
27365
|
+
false
|
|
27366
|
+
];
|
|
27367
|
+
}
|
|
27335
27368
|
flushBeforeDynamic && flushBeforeDynamic(child, push);
|
|
27336
27369
|
push(...genSelf(child, context, flushBeforeDynamic));
|
|
27337
27370
|
continue;
|
|
@@ -27343,9 +27376,8 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flush
|
|
|
27343
27376
|
continue;
|
|
27344
27377
|
}
|
|
27345
27378
|
const elementIndex = index + offset;
|
|
27346
|
-
const logicalIndex = child.logicalIndex !== void 0 ? String(child.logicalIndex) : void 0;
|
|
27347
27379
|
const inlinePlaceholder = id === void 0 && canInlinePlaceholder(child) && child.template == null && child.operation === void 0 && !(child.flags & 6);
|
|
27348
|
-
const accessPath = genAccessPath(context, from,
|
|
27380
|
+
const accessPath = genAccessPath(context, from, elementIndex, prev);
|
|
27349
27381
|
if (inlinePlaceholder) {
|
|
27350
27382
|
if (prev && prev[2]) {
|
|
27351
27383
|
push(...genChildren(child, context, pushBlock, [
|
|
@@ -27393,11 +27425,14 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flush
|
|
|
27393
27425
|
* Build one DOM lookup path while preserving the fast sibling walk:
|
|
27394
27426
|
* adjacent nodes use _next(prev), otherwise fall back to _nthChild(parent).
|
|
27395
27427
|
*/
|
|
27396
|
-
function genAccessPath({ helper }, from,
|
|
27397
|
-
if (prev) return elementIndex - prev[1] === 1 ? genCall(helper("next"), prev[0]
|
|
27398
|
-
if (elementIndex === 0) return genCall(helper("child"), from
|
|
27399
|
-
|
|
27400
|
-
|
|
27428
|
+
function genAccessPath({ helper }, from, elementIndex, prev) {
|
|
27429
|
+
if (prev) return elementIndex - prev[1] === 1 ? genCall(helper("next"), prev[0]) : genCall(helper("nthChild"), from, String(elementIndex));
|
|
27430
|
+
if (elementIndex === 0) return genCall(helper("child"), from);
|
|
27431
|
+
if (elementIndex === 1) {
|
|
27432
|
+
const firstChild = genCall(helper("child"), from);
|
|
27433
|
+
return genCall(helper("next"), firstChild);
|
|
27434
|
+
}
|
|
27435
|
+
return genCall(helper("nthChild"), from, String(elementIndex));
|
|
27401
27436
|
}
|
|
27402
27437
|
/**
|
|
27403
27438
|
* Only inline a placeholder when materializing it would not save a parent
|
|
@@ -27410,13 +27445,15 @@ function canInlinePlaceholder(dynamic) {
|
|
|
27410
27445
|
/**
|
|
27411
27446
|
* A following access can reuse the current placeholder cursor only when it is
|
|
27412
27447
|
* the next DOM sibling. Gapped siblings need _nthChild(parent, index) instead.
|
|
27448
|
+
* Kept in lockstep with genChildren's traversal rules.
|
|
27413
27449
|
*/
|
|
27414
27450
|
function hasAdjacentFollowingAccessChild(children, index, elementIndex, offset) {
|
|
27415
27451
|
let futureOffset = offset;
|
|
27416
27452
|
for (let i = index + 1; i < children.length; i++) {
|
|
27417
27453
|
const child = children[i];
|
|
27418
27454
|
if (child.flags & 2) futureOffset--;
|
|
27419
|
-
if (
|
|
27455
|
+
if (child.flags & 4 && child.anchor === void 0) continue;
|
|
27456
|
+
if (!!(child.flags & 1) || child.hasDynamicChild) return i + futureOffset - elementIndex === 1;
|
|
27420
27457
|
}
|
|
27421
27458
|
return false;
|
|
27422
27459
|
}
|
|
@@ -27431,7 +27468,7 @@ function countParentAccessUsages(dynamic) {
|
|
|
27431
27468
|
let prev;
|
|
27432
27469
|
for (const [index, child] of dynamic.children.entries()) {
|
|
27433
27470
|
if (child.flags & 2) offset--;
|
|
27434
|
-
if (child.flags & 4 && child.template != null) continue;
|
|
27471
|
+
if (child.flags & 4 && child.template != null && child.anchor === void 0) continue;
|
|
27435
27472
|
const id = child.flags & 1 ? child.flags & 4 ? child.anchor : child.id : void 0;
|
|
27436
27473
|
if (id === void 0 && !child.hasDynamicChild) continue;
|
|
27437
27474
|
const elementIndex = index + offset;
|
|
@@ -27452,10 +27489,6 @@ function countParentAccessUsages(dynamic) {
|
|
|
27452
27489
|
}
|
|
27453
27490
|
return usages;
|
|
27454
27491
|
}
|
|
27455
|
-
function genNthChild(nthChild, from, elementIndex, logicalIndex) {
|
|
27456
|
-
const index = String(elementIndex);
|
|
27457
|
-
return genCall(nthChild, from, index, logicalIndex === index ? void 0 : logicalIndex);
|
|
27458
|
-
}
|
|
27459
27492
|
//#endregion
|
|
27460
27493
|
//#region packages/compiler-vapor/src/generators/block.ts
|
|
27461
27494
|
function genBlock(oper, context, args = [], root) {
|
|
@@ -27473,6 +27506,7 @@ function genBlock(oper, context, args = [], root) {
|
|
|
27473
27506
|
function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffectIndexes) {
|
|
27474
27507
|
const [frag, push] = buildCodeFragment();
|
|
27475
27508
|
const { dynamic, effect, operation, returns } = block;
|
|
27509
|
+
const modelOperations = operation.filter(isVModelOperation);
|
|
27476
27510
|
const resetBlock = context.enterBlock(block);
|
|
27477
27511
|
const singleUseAssetComponentNames = root ? collectSingleUseAssetComponents(block) : void 0;
|
|
27478
27512
|
const prevSingleUseAssetComponentNames = context.singleUseAssetComponentNames;
|
|
@@ -27491,7 +27525,8 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
|
|
|
27491
27525
|
let effectIndex = 0;
|
|
27492
27526
|
const flushPendingOperations = (operationEnd, effectEnd, push) => {
|
|
27493
27527
|
while (operationIndex < operationEnd) {
|
|
27494
|
-
|
|
27528
|
+
const oper = operation[operationIndex];
|
|
27529
|
+
if (!isVModelOperation(oper)) push(...genOperationWithInsertionState(oper, context));
|
|
27495
27530
|
operationIndex++;
|
|
27496
27531
|
}
|
|
27497
27532
|
if (effectIndex < effectEnd) {
|
|
@@ -27508,9 +27543,10 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
|
|
|
27508
27543
|
push(...genSelf(child, context, flushBeforeDynamic));
|
|
27509
27544
|
}
|
|
27510
27545
|
for (const child of dynamic.children) if (!child.hasDynamicChild) push(...genChildren(child, context, push, `n${child.id}`, flushBeforeDynamic));
|
|
27511
|
-
if (operationIndex < operation.length) push(...genOperations(operation.slice(operationIndex), context));
|
|
27546
|
+
if (operationIndex < operation.length) push(...genOperations(operation.slice(operationIndex).filter((oper) => !isVModelOperation(oper)), context));
|
|
27512
27547
|
if (effectIndex < effect.length) push(...genEffectRange(effectIndex, effect.length, genEffectsExtraFrag));
|
|
27513
27548
|
else if (genEffectsExtraFrag) push(...genEffects([], context, genEffectsExtraFrag));
|
|
27549
|
+
if (modelOperations.length) push(...genOperations(modelOperations, context));
|
|
27514
27550
|
push(NEWLINE, `return `);
|
|
27515
27551
|
const returnNodes = returns.map((n) => `n${n}`);
|
|
27516
27552
|
push(...returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "[]"]);
|
|
@@ -27528,27 +27564,48 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
|
|
|
27528
27564
|
for (const name of context.ir[kind]) push(NEWLINE, `const ${toValidAssetId(name, kind)} = `, ...genCall(context.helper(helper), JSON.stringify(name)));
|
|
27529
27565
|
}
|
|
27530
27566
|
}
|
|
27531
|
-
function
|
|
27567
|
+
function isVModelOperation(oper) {
|
|
27568
|
+
return oper.type === 13 && oper.builtin === true && oper.name === "model";
|
|
27569
|
+
}
|
|
27570
|
+
function markSlotRootOperations(block, context, sharedFallback = false) {
|
|
27571
|
+
if (hasStableSlotRoot(block, context)) return;
|
|
27572
|
+
sharedFallback = sharedFallback || hasMultipleDynamicSlotRoots(block);
|
|
27532
27573
|
for (let i = 0; i < block.returns.length; i++) {
|
|
27533
27574
|
const child = findReturnedDynamic$1(block, block.returns[i]);
|
|
27534
27575
|
const operation = child && child.operation;
|
|
27535
27576
|
if (!operation) continue;
|
|
27536
|
-
if (operation.type ===
|
|
27537
|
-
else if (operation.type ===
|
|
27538
|
-
else if (operation.type ===
|
|
27577
|
+
if (operation.type === 14) markSlotRootIf(operation, context, sharedFallback);
|
|
27578
|
+
else if (operation.type === 15) markSlotRootFor(operation, context);
|
|
27579
|
+
else if (operation.type === 16) {
|
|
27580
|
+
operation.slotRoot = true;
|
|
27581
|
+
markSlotRootOperations(operation.block, context, sharedFallback);
|
|
27582
|
+
} else if (operation.type === 11) markSlotRootComponent(operation);
|
|
27583
|
+
else if (operation.type === 12) {
|
|
27584
|
+
if (!(operation.flags & 2)) operation.flags |= 4;
|
|
27585
|
+
if (sharedFallback) operation.flags |= 16;
|
|
27586
|
+
else operation.flags |= 32;
|
|
27587
|
+
}
|
|
27539
27588
|
}
|
|
27540
27589
|
}
|
|
27541
|
-
function markSlotRootIf(operation) {
|
|
27590
|
+
function markSlotRootIf(operation, context, sharedFallback) {
|
|
27542
27591
|
if (!operation.once) operation.slotRoot = true;
|
|
27543
|
-
markSlotRootOperations(operation.positive);
|
|
27592
|
+
markSlotRootOperations(operation.positive, context, sharedFallback);
|
|
27544
27593
|
const negative = operation.negative;
|
|
27545
27594
|
if (!negative) return;
|
|
27546
|
-
if (negative.type ===
|
|
27547
|
-
else markSlotRootOperations(negative);
|
|
27595
|
+
if (negative.type === 14) markSlotRootIf(negative, context, sharedFallback);
|
|
27596
|
+
else markSlotRootOperations(negative, context, sharedFallback);
|
|
27548
27597
|
}
|
|
27549
|
-
function markSlotRootFor(operation) {
|
|
27598
|
+
function markSlotRootFor(operation, context) {
|
|
27550
27599
|
if (!operation.once) operation.slotRoot = true;
|
|
27551
|
-
markSlotRootOperations(operation.render);
|
|
27600
|
+
markSlotRootOperations(operation.render, context, true);
|
|
27601
|
+
}
|
|
27602
|
+
function hasMultipleDynamicSlotRoots(block) {
|
|
27603
|
+
let count = 0;
|
|
27604
|
+
for (let i = 0; i < block.returns.length; i++) {
|
|
27605
|
+
const child = findReturnedDynamic$1(block, block.returns[i]);
|
|
27606
|
+
if (child && child.operation && ++count > 1) return true;
|
|
27607
|
+
}
|
|
27608
|
+
return false;
|
|
27552
27609
|
}
|
|
27553
27610
|
function markSlotRootComponent(operation) {
|
|
27554
27611
|
if (!operation.once && operation.dynamic && !operation.dynamic.isStatic) operation.slotRoot = true;
|
|
@@ -27559,6 +27616,40 @@ function findReturnedDynamic$1(block, id) {
|
|
|
27559
27616
|
if (child.id === id) return child;
|
|
27560
27617
|
}
|
|
27561
27618
|
}
|
|
27619
|
+
const commentOnlyTemplateRE = /^(?:<!--[\s\S]*?-->)+$/;
|
|
27620
|
+
function hasStableSlotRoot(block, context) {
|
|
27621
|
+
let hasValidRoot = false;
|
|
27622
|
+
for (let i = 0; i < block.returns.length; i++) {
|
|
27623
|
+
const id = block.returns[i];
|
|
27624
|
+
const child = findReturnedDynamic$1(block, id);
|
|
27625
|
+
const operation = child && child.operation;
|
|
27626
|
+
if (!operation) {
|
|
27627
|
+
if (child && isStableTemplateSlotRoot(child, context)) hasValidRoot = true;
|
|
27628
|
+
continue;
|
|
27629
|
+
}
|
|
27630
|
+
switch (operation.type) {
|
|
27631
|
+
case 11:
|
|
27632
|
+
if (!operation.dynamic || operation.dynamic.isStatic) {
|
|
27633
|
+
hasValidRoot = true;
|
|
27634
|
+
continue;
|
|
27635
|
+
}
|
|
27636
|
+
continue;
|
|
27637
|
+
case 16:
|
|
27638
|
+
if (hasStableSlotRoot(operation.block, context)) {
|
|
27639
|
+
hasValidRoot = true;
|
|
27640
|
+
continue;
|
|
27641
|
+
}
|
|
27642
|
+
continue;
|
|
27643
|
+
default: continue;
|
|
27644
|
+
}
|
|
27645
|
+
}
|
|
27646
|
+
return hasValidRoot;
|
|
27647
|
+
}
|
|
27648
|
+
function isStableTemplateSlotRoot(child, context) {
|
|
27649
|
+
if (child.template == null) return false;
|
|
27650
|
+
const content = context.ir.template.entries[child.template].content;
|
|
27651
|
+
return content !== "" && !commentOnlyTemplateRE.test(content.trim());
|
|
27652
|
+
}
|
|
27562
27653
|
function collectSingleUseAssetComponents(block) {
|
|
27563
27654
|
const usageMap = /* @__PURE__ */ new Map();
|
|
27564
27655
|
const seenOperations = /* @__PURE__ */ new Set();
|
|
@@ -27578,7 +27669,7 @@ function collectSingleUseAssetComponents(block) {
|
|
|
27578
27669
|
function visitOperation(operation, rootCandidate) {
|
|
27579
27670
|
if (seenOperations.has(operation)) return;
|
|
27580
27671
|
seenOperations.add(operation);
|
|
27581
|
-
if (operation.type ===
|
|
27672
|
+
if (operation.type === 11) {
|
|
27582
27673
|
if (operation.asset) {
|
|
27583
27674
|
const usage = usageMap.get(operation.tag) || {
|
|
27584
27675
|
count: 0,
|
|
@@ -27592,18 +27683,18 @@ function collectSingleUseAssetComponents(block) {
|
|
|
27592
27683
|
return;
|
|
27593
27684
|
}
|
|
27594
27685
|
switch (operation.type) {
|
|
27595
|
-
case
|
|
27686
|
+
case 14:
|
|
27596
27687
|
visitBlock(operation.positive, false);
|
|
27597
|
-
if (operation.negative) if (operation.negative.type ===
|
|
27688
|
+
if (operation.negative) if (operation.negative.type === 14) visitOperation(operation.negative, false);
|
|
27598
27689
|
else visitBlock(operation.negative, false);
|
|
27599
27690
|
break;
|
|
27600
|
-
case
|
|
27691
|
+
case 15:
|
|
27601
27692
|
visitBlock(operation.render, false);
|
|
27602
27693
|
break;
|
|
27603
|
-
case
|
|
27694
|
+
case 16:
|
|
27604
27695
|
visitBlock(operation.block, false);
|
|
27605
27696
|
break;
|
|
27606
|
-
case
|
|
27697
|
+
case 12:
|
|
27607
27698
|
if (operation.fallback) visitBlock(operation.fallback, false);
|
|
27608
27699
|
break;
|
|
27609
27700
|
}
|
|
@@ -27672,11 +27763,28 @@ var CodegenContext = class {
|
|
|
27672
27763
|
enterScope() {
|
|
27673
27764
|
return [this.scopeLevel++, () => this.scopeLevel--];
|
|
27674
27765
|
}
|
|
27675
|
-
|
|
27676
|
-
|
|
27766
|
+
getUniqueLocalName(base, scopeNames) {
|
|
27767
|
+
const name = this.findAvailableName(base, scopeNames);
|
|
27768
|
+
scopeNames.add(name);
|
|
27769
|
+
this.generatedLocalNames.add(name);
|
|
27770
|
+
return name;
|
|
27771
|
+
}
|
|
27772
|
+
isNameAvailable(name, reservedNames) {
|
|
27773
|
+
if (this.bindingNames.has(name) || reservedNames.has(name)) return false;
|
|
27677
27774
|
for (const alias of this.helpers.values()) if (alias === name) return false;
|
|
27678
27775
|
return true;
|
|
27679
27776
|
}
|
|
27777
|
+
findAvailableName(base, reservedNames) {
|
|
27778
|
+
if (this.isNameAvailable(base, reservedNames)) return base;
|
|
27779
|
+
const map = this.nextIdMap.get(base);
|
|
27780
|
+
let next = 1;
|
|
27781
|
+
while (true) {
|
|
27782
|
+
const id = getNextId(map, next);
|
|
27783
|
+
const name = `${base}${id}`;
|
|
27784
|
+
if (this.isNameAvailable(name, reservedNames)) return name;
|
|
27785
|
+
next = id + 1;
|
|
27786
|
+
}
|
|
27787
|
+
}
|
|
27680
27788
|
initNextIdMap() {
|
|
27681
27789
|
if (this.bindingNames.size === 0) return;
|
|
27682
27790
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -27716,20 +27824,9 @@ var CodegenContext = class {
|
|
|
27716
27824
|
this.helper = (name) => {
|
|
27717
27825
|
if (this.helpers.has(name)) return this.helpers.get(name);
|
|
27718
27826
|
const base = `_${helperNameAliases[name] || name}`;
|
|
27719
|
-
|
|
27720
|
-
|
|
27721
|
-
|
|
27722
|
-
}
|
|
27723
|
-
const map = this.nextIdMap.get(base);
|
|
27724
|
-
let next = 1;
|
|
27725
|
-
while (true) {
|
|
27726
|
-
const alias = `${base}${getNextId(map, next)}`;
|
|
27727
|
-
if (this.isHelperNameAvailable(alias)) {
|
|
27728
|
-
this.helpers.set(name, alias);
|
|
27729
|
-
return alias;
|
|
27730
|
-
}
|
|
27731
|
-
next++;
|
|
27732
|
-
}
|
|
27827
|
+
const alias = this.findAvailableName(base, this.generatedLocalNames);
|
|
27828
|
+
this.helpers.set(name, alias);
|
|
27829
|
+
return alias;
|
|
27733
27830
|
};
|
|
27734
27831
|
this.delegates = /* @__PURE__ */ new Set();
|
|
27735
27832
|
this.identifiers = Object.create(null);
|
|
@@ -27739,6 +27836,7 @@ var CodegenContext = class {
|
|
|
27739
27836
|
this.templateVars = /* @__PURE__ */ new Map();
|
|
27740
27837
|
this.nextIdMap = /* @__PURE__ */ new Map();
|
|
27741
27838
|
this.lastIdMap = /* @__PURE__ */ new Map();
|
|
27839
|
+
this.generatedLocalNames = /* @__PURE__ */ new Set();
|
|
27742
27840
|
this.lastTIndex = -1;
|
|
27743
27841
|
const defaultOptions = {
|
|
27744
27842
|
mode: "module",
|
|
@@ -27870,11 +27968,14 @@ const transformVHtml = (dir, node, context) => {
|
|
|
27870
27968
|
exp = EMPTY_EXPRESSION;
|
|
27871
27969
|
}
|
|
27872
27970
|
ignoreVHtmlChildren(node, context, "template");
|
|
27971
|
+
if (node.tagType === 1) return {
|
|
27972
|
+
key: createSimpleExpression("innerHTML", true, loc),
|
|
27973
|
+
value: exp
|
|
27974
|
+
};
|
|
27873
27975
|
context.registerEffect([exp], {
|
|
27874
27976
|
type: 8,
|
|
27875
27977
|
element: context.reference(),
|
|
27876
|
-
value: exp
|
|
27877
|
-
isComponent: node.tagType === 1
|
|
27978
|
+
value: exp
|
|
27878
27979
|
});
|
|
27879
27980
|
};
|
|
27880
27981
|
//#endregion
|
|
@@ -27968,7 +28069,7 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
27968
28069
|
context.dynamic.flags |= 6;
|
|
27969
28070
|
const id = context.reference();
|
|
27970
28071
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
27971
|
-
type:
|
|
28072
|
+
type: 11,
|
|
27972
28073
|
id
|
|
27973
28074
|
}, context.effectBoundary()), {}, {
|
|
27974
28075
|
tag,
|
|
@@ -28014,27 +28115,22 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
28014
28115
|
tag
|
|
28015
28116
|
}, getEffectIndex);
|
|
28016
28117
|
} else {
|
|
28017
|
-
let prevWasQuoted = false;
|
|
28018
28118
|
const appendTemplateProp = (key, value = "", generated = false) => {
|
|
28019
|
-
|
|
28020
|
-
template += key;
|
|
28119
|
+
template += ` ${key}`;
|
|
28021
28120
|
if (value) {
|
|
28022
28121
|
const escapedValue = generated ? escapeGeneratedAttrValue(value) : value.replace(/"/g, """);
|
|
28023
|
-
template +=
|
|
28024
|
-
}
|
|
28122
|
+
template += NEEDS_QUOTES_RE.test(value) ? `="${escapedValue}"` : `=${escapedValue}`;
|
|
28123
|
+
}
|
|
28025
28124
|
};
|
|
28026
28125
|
for (const prop of propsResult[1]) {
|
|
28027
28126
|
const { key, values } = prop;
|
|
28028
28127
|
const canStringifyAttrName = key.isStatic && !UNSAFE_ATTR_NAME_RE.test(key.content);
|
|
28029
28128
|
let foldedValue;
|
|
28030
|
-
if (canStringifyAttrName && context.imports.some((imported) => values[0].content.includes(imported.exp.content))) {
|
|
28031
|
-
|
|
28032
|
-
template += `${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
|
|
28033
|
-
prevWasQuoted = true;
|
|
28034
|
-
} else if (canStringifyAttrName && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
|
|
28129
|
+
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}"`;
|
|
28130
|
+
else if (canStringifyAttrName && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
|
|
28035
28131
|
const value = values[0].content === "''" ? "" : values[0].content;
|
|
28036
28132
|
appendTemplateProp(key.content, value);
|
|
28037
|
-
} else if (canStringifyAttrName && !prop.modifier && isBooleanAttr(key.content) && (foldedValue = foldBooleanAttrValue(values)) != null) {
|
|
28133
|
+
} else if (canStringifyAttrName && !prop.modifier && (isBooleanAttr(key.content) || key.content === "hidden") && (foldedValue = foldBooleanAttrValue(key.content, values)) != null) {
|
|
28038
28134
|
if (foldedValue) appendTemplateProp(key.content);
|
|
28039
28135
|
} else if (canStringifyAttrName && !prop.modifier && hasBoundValue(values) && (foldedValue = key.content === "class" ? foldClassValues(values) : key.content === "style" ? foldStyleValues(values) : void 0) != null) {
|
|
28040
28136
|
if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
|
|
@@ -28059,11 +28155,12 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
28059
28155
|
function escapeGeneratedAttrValue(value) {
|
|
28060
28156
|
return value.replace(/&/g, "&").replace(/"/g, """);
|
|
28061
28157
|
}
|
|
28062
|
-
function foldBooleanAttrValue(values) {
|
|
28158
|
+
function foldBooleanAttrValue(key, values) {
|
|
28063
28159
|
if (values.length !== 1) return;
|
|
28064
28160
|
const evaluated = evaluateConstantExpression(values[0]);
|
|
28065
28161
|
if (!evaluated) return;
|
|
28066
28162
|
const value = evaluated.value;
|
|
28163
|
+
if (key === "hidden" && typeof value === "number") return includeBooleanAttr(value);
|
|
28067
28164
|
if (value === true || value === false || value == null) return includeBooleanAttr(value);
|
|
28068
28165
|
}
|
|
28069
28166
|
function foldStyleValues(values) {
|
|
@@ -28425,7 +28522,7 @@ function transformProp(prop, node, context) {
|
|
|
28425
28522
|
if (fromSetup) name = fromSetup;
|
|
28426
28523
|
else context.directive.add(name);
|
|
28427
28524
|
context.registerOperation({
|
|
28428
|
-
type:
|
|
28525
|
+
type: 13,
|
|
28429
28526
|
element: context.reference(),
|
|
28430
28527
|
dir: prop,
|
|
28431
28528
|
name,
|
|
@@ -28506,49 +28603,33 @@ const transformChildren = (node, context) => {
|
|
|
28506
28603
|
if (!isFragment) processDynamicChildren(context);
|
|
28507
28604
|
};
|
|
28508
28605
|
function processDynamicChildren(context) {
|
|
28509
|
-
let prevDynamics = [];
|
|
28510
|
-
let staticCount = 0;
|
|
28511
28606
|
const children = context.dynamic.children;
|
|
28512
|
-
let
|
|
28513
|
-
for (
|
|
28514
|
-
|
|
28515
|
-
|
|
28516
|
-
|
|
28517
|
-
|
|
28518
|
-
|
|
28519
|
-
|
|
28520
|
-
|
|
28521
|
-
|
|
28522
|
-
|
|
28523
|
-
|
|
28524
|
-
|
|
28525
|
-
|
|
28526
|
-
registerInsertion(prevDynamics, context, anchor);
|
|
28527
|
-
} else registerInsertion(prevDynamics, context, -1);
|
|
28528
|
-
prevDynamics = [];
|
|
28529
|
-
}
|
|
28530
|
-
staticCount++;
|
|
28531
|
-
logicalIndex++;
|
|
28532
|
-
}
|
|
28533
|
-
}
|
|
28534
|
-
if (prevDynamics.length) registerInsertion(prevDynamics, context, prevDynamics[0].logicalIndex, true);
|
|
28535
|
-
}
|
|
28536
|
-
function registerInsertion(dynamics, context, anchor, append) {
|
|
28537
|
-
for (const child of dynamics) {
|
|
28538
|
-
const logicalIndex = child.logicalIndex;
|
|
28539
|
-
if (child.template != null) context.registerOperation({
|
|
28607
|
+
let lastTemplateIndex = -1;
|
|
28608
|
+
for (let i = children.length - 1; i >= 0; i--) if (!(children[i].flags & 2)) {
|
|
28609
|
+
lastTemplateIndex = i;
|
|
28610
|
+
break;
|
|
28611
|
+
}
|
|
28612
|
+
let unitIndex = 0;
|
|
28613
|
+
for (const [index, child] of children.entries()) if (child.flags & 4) {
|
|
28614
|
+
let anchor;
|
|
28615
|
+
if (index < lastTemplateIndex) {
|
|
28616
|
+
context.childrenTemplate[index] = `<!>`;
|
|
28617
|
+
child.flags = child.flags - 2 | 1;
|
|
28618
|
+
anchor = child.anchor = context.increaseId();
|
|
28619
|
+
}
|
|
28620
|
+
if (child.template != null) child.operation = {
|
|
28540
28621
|
type: 10,
|
|
28541
|
-
elements:
|
|
28622
|
+
elements: [child.id],
|
|
28542
28623
|
parent: context.reference(),
|
|
28543
|
-
anchor
|
|
28544
|
-
}
|
|
28624
|
+
anchor
|
|
28625
|
+
};
|
|
28545
28626
|
else if (child.operation && isBlockOperation(child.operation)) {
|
|
28546
28627
|
child.operation.parent = context.reference();
|
|
28547
|
-
child.operation.anchor = anchor;
|
|
28548
|
-
child.operation.
|
|
28549
|
-
child.operation.append = append;
|
|
28628
|
+
if (anchor !== void 0) child.operation.anchor = anchor;
|
|
28629
|
+
else child.operation.appendIndex = unitIndex;
|
|
28550
28630
|
}
|
|
28551
|
-
|
|
28631
|
+
unitIndex++;
|
|
28632
|
+
} else if (!(child.flags & 2)) unitIndex++;
|
|
28552
28633
|
}
|
|
28553
28634
|
//#endregion
|
|
28554
28635
|
//#region packages/compiler-vapor/src/transforms/vOnce.ts
|
|
@@ -28642,7 +28723,7 @@ function processTextContainer(children, context) {
|
|
|
28642
28723
|
else {
|
|
28643
28724
|
context.childrenTemplate = [" "];
|
|
28644
28725
|
context.registerOperation({
|
|
28645
|
-
type:
|
|
28726
|
+
type: 17,
|
|
28646
28727
|
parent: context.reference()
|
|
28647
28728
|
});
|
|
28648
28729
|
context.registerEffect(values, {
|
|
@@ -28698,6 +28779,7 @@ function isTextLike(node) {
|
|
|
28698
28779
|
}
|
|
28699
28780
|
//#endregion
|
|
28700
28781
|
//#region packages/compiler-vapor/src/transforms/vText.ts
|
|
28782
|
+
const isRawTextContainer = /* @__PURE__ */ makeMap("iframe,noembed,noframes,noscript,script,style,xmp");
|
|
28701
28783
|
const transformVText = (dir, node, context) => {
|
|
28702
28784
|
let { exp, loc } = dir;
|
|
28703
28785
|
if (!exp) {
|
|
@@ -28710,18 +28792,22 @@ const transformVText = (dir, node, context) => {
|
|
|
28710
28792
|
for (const child of node.children) markNonTemplate(child, context);
|
|
28711
28793
|
}
|
|
28712
28794
|
if (isVoidTag(context.node.tag)) return;
|
|
28795
|
+
if (node.tagType === 1) return {
|
|
28796
|
+
key: createSimpleExpression("textContent", true),
|
|
28797
|
+
value: exp,
|
|
28798
|
+
toDisplayString: !isConstantVTextExpression(exp, context.options.bindingMetadata)
|
|
28799
|
+
};
|
|
28713
28800
|
const literal = getLiteralExpressionValue(exp);
|
|
28714
28801
|
const useCreateElement = shouldUseCreateElement(context.node, context);
|
|
28715
|
-
if (literal != null) if (useCreateElement) {
|
|
28802
|
+
if (literal != null) if (useCreateElement || isRawTextContainer(node.tag)) {
|
|
28716
28803
|
const id = registerSyntheticTextChild(context, "", [exp]);
|
|
28717
28804
|
context.registerOperation({
|
|
28718
28805
|
type: 10,
|
|
28719
28806
|
elements: [id],
|
|
28720
28807
|
parent: context.reference()
|
|
28721
28808
|
});
|
|
28722
|
-
} else context.childrenTemplate = [
|
|
28809
|
+
} else context.childrenTemplate = [escapeHtml(literal)];
|
|
28723
28810
|
else {
|
|
28724
|
-
const isComponent = node.tagType === 1;
|
|
28725
28811
|
let id;
|
|
28726
28812
|
if (useCreateElement) {
|
|
28727
28813
|
id = registerSyntheticTextChild(context, "");
|
|
@@ -28730,10 +28816,10 @@ const transformVText = (dir, node, context) => {
|
|
|
28730
28816
|
elements: [id],
|
|
28731
28817
|
parent: context.reference()
|
|
28732
28818
|
});
|
|
28733
|
-
} else
|
|
28819
|
+
} else {
|
|
28734
28820
|
context.childrenTemplate = [" "];
|
|
28735
28821
|
context.registerOperation({
|
|
28736
|
-
type:
|
|
28822
|
+
type: 17,
|
|
28737
28823
|
parent: context.reference()
|
|
28738
28824
|
});
|
|
28739
28825
|
}
|
|
@@ -28741,11 +28827,24 @@ const transformVText = (dir, node, context) => {
|
|
|
28741
28827
|
type: 5,
|
|
28742
28828
|
element: useCreateElement ? id : context.reference(),
|
|
28743
28829
|
values: [exp],
|
|
28744
|
-
generated: !useCreateElement
|
|
28745
|
-
isComponent
|
|
28830
|
+
generated: !useCreateElement
|
|
28746
28831
|
});
|
|
28747
28832
|
}
|
|
28748
28833
|
};
|
|
28834
|
+
function isConstantVTextExpression(exp, bindings) {
|
|
28835
|
+
if (isConstantExpression(exp)) return true;
|
|
28836
|
+
if (exp.ast === null) {
|
|
28837
|
+
const type = bindings[exp.content];
|
|
28838
|
+
return type === "setup-const" || type === "literal-const";
|
|
28839
|
+
}
|
|
28840
|
+
if (!exp.ast) return false;
|
|
28841
|
+
let isConstant = true;
|
|
28842
|
+
walkIdentifiers(exp.ast, (id, parent, _parentStack, isReferenced) => {
|
|
28843
|
+
if (parent && isStaticPropertyKey(id, parent)) return;
|
|
28844
|
+
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;
|
|
28845
|
+
}, true);
|
|
28846
|
+
return isConstant;
|
|
28847
|
+
}
|
|
28749
28848
|
//#endregion
|
|
28750
28849
|
//#region packages/compiler-vapor/src/transforms/vOn.ts
|
|
28751
28850
|
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");
|
|
@@ -28754,6 +28853,16 @@ const transformVOn = (dir, node, context) => {
|
|
|
28754
28853
|
const isComponent = node.tagType === 1;
|
|
28755
28854
|
const isSlotOutlet = node.tag === "slot";
|
|
28756
28855
|
if (!exp && !modifiers.length) context.options.onError(createCompilerError(35, loc));
|
|
28856
|
+
let delegateModifier;
|
|
28857
|
+
let nonDelegateModifiers;
|
|
28858
|
+
for (let i = 0; i < modifiers.length; i++) {
|
|
28859
|
+
const modifier = modifiers[i];
|
|
28860
|
+
if (modifier.content === "delegate") {
|
|
28861
|
+
delegateModifier || (delegateModifier = modifier);
|
|
28862
|
+
nonDelegateModifiers || (nonDelegateModifiers = modifiers.slice(0, i));
|
|
28863
|
+
} else if (nonDelegateModifiers) nonDelegateModifiers.push(modifier);
|
|
28864
|
+
}
|
|
28865
|
+
if (nonDelegateModifiers) modifiers = nonDelegateModifiers;
|
|
28757
28866
|
arg = resolveExpression(arg);
|
|
28758
28867
|
if (arg.isStatic && arg.content.startsWith("vue:")) arg = extend({}, arg, { content: `vnode-${arg.content.slice(4)}` });
|
|
28759
28868
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(arg.isStatic ? `on${arg.content}` : arg, modifiers, null, loc);
|
|
@@ -28766,17 +28875,24 @@ const transformVOn = (dir, node, context) => {
|
|
|
28766
28875
|
}
|
|
28767
28876
|
arg = normalizeStaticEventArg(arg, nonKeyModifiers);
|
|
28768
28877
|
if (keyModifiers.length && isStaticExp(arg) && !isKeyboardEvent(`on${arg.content.toLowerCase()}`)) keyModifiers.length = 0;
|
|
28769
|
-
if (isComponent || isSlotOutlet)
|
|
28770
|
-
|
|
28771
|
-
|
|
28772
|
-
|
|
28773
|
-
|
|
28774
|
-
|
|
28775
|
-
|
|
28776
|
-
|
|
28777
|
-
|
|
28778
|
-
|
|
28779
|
-
|
|
28878
|
+
if (isComponent || isSlotOutlet) {
|
|
28879
|
+
if (delegateModifier) warnDelegate(context, delegateModifier, ".delegate modifier is only supported on native DOM elements. The modifier will be ignored.");
|
|
28880
|
+
return {
|
|
28881
|
+
key: arg,
|
|
28882
|
+
value: exp || EMPTY_EXPRESSION,
|
|
28883
|
+
handler: true,
|
|
28884
|
+
handlerModifiers: {
|
|
28885
|
+
keys: keyModifiers,
|
|
28886
|
+
nonKeys: nonKeyModifiers,
|
|
28887
|
+
options: eventOptionModifiers
|
|
28888
|
+
}
|
|
28889
|
+
};
|
|
28890
|
+
}
|
|
28891
|
+
const isDelegatableEvent = !!delegateModifier && arg.isStatic && delegatedEvents(arg.content);
|
|
28892
|
+
const hasStopHandler = isDelegatableEvent && !eventOptionModifiers.length && hasStopHandlerForStaticEvent(node, arg.content);
|
|
28893
|
+
if (delegateModifier && !arg.isStatic) warnDelegate(context, delegateModifier, ".delegate modifier requires a static event name. The listener will be attached directly.");
|
|
28894
|
+
else if (delegateModifier && !isDelegatableEvent) warnDelegate(context, delegateModifier, `.delegate modifier is not supported on the "${arg.content}" event. The listener will be attached directly.`);
|
|
28895
|
+
const delegate = isDelegatableEvent && !eventOptionModifiers.length && !hasStopHandler;
|
|
28780
28896
|
const operation = {
|
|
28781
28897
|
type: 6,
|
|
28782
28898
|
element: context.reference(),
|
|
@@ -28810,6 +28926,11 @@ function hasStopHandlerForStaticEvent(node, eventName) {
|
|
|
28810
28926
|
return nonKeyModifiers.includes("stop") && normalizeStaticEventArg(arg, nonKeyModifiers).content === eventName;
|
|
28811
28927
|
});
|
|
28812
28928
|
}
|
|
28929
|
+
function warnDelegate(context, modifier, message) {
|
|
28930
|
+
const error = new SyntaxError(message);
|
|
28931
|
+
error.loc = modifier.loc;
|
|
28932
|
+
context.options.onWarn(error);
|
|
28933
|
+
}
|
|
28813
28934
|
//#endregion
|
|
28814
28935
|
//#region packages/compiler-vapor/src/transforms/vShow.ts
|
|
28815
28936
|
const transformVShow = (dir, node, context) => {
|
|
@@ -28823,7 +28944,7 @@ const transformVShow = (dir, node, context) => {
|
|
|
28823
28944
|
return;
|
|
28824
28945
|
}
|
|
28825
28946
|
context.registerOperation({
|
|
28826
|
-
type:
|
|
28947
|
+
type: 13,
|
|
28827
28948
|
element: context.reference(),
|
|
28828
28949
|
dir,
|
|
28829
28950
|
name: "show",
|
|
@@ -28907,7 +29028,7 @@ const transformVModel = (dir, node, context) => {
|
|
|
28907
29028
|
else checkDuplicatedValue();
|
|
28908
29029
|
else context.options.onError(createDOMCompilerError(58, dir.loc));
|
|
28909
29030
|
if (modelType) context.registerOperation({
|
|
28910
|
-
type:
|
|
29031
|
+
type: 13,
|
|
28911
29032
|
element: context.reference(),
|
|
28912
29033
|
dir,
|
|
28913
29034
|
name: "model",
|
|
@@ -28972,7 +29093,7 @@ function processIf(node, dir, context) {
|
|
|
28972
29093
|
return () => {
|
|
28973
29094
|
onExit();
|
|
28974
29095
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
28975
|
-
type:
|
|
29096
|
+
type: 14,
|
|
28976
29097
|
id
|
|
28977
29098
|
}, context.effectBoundary()), {}, {
|
|
28978
29099
|
blockShape: encodeIfBlockShape(branch, forceMultiRoot, void 0, allowNoScope),
|
|
@@ -28988,16 +29109,16 @@ function processIf(node, dir, context) {
|
|
|
28988
29109
|
let lastIfNode;
|
|
28989
29110
|
if (siblings) {
|
|
28990
29111
|
let i = siblings.length;
|
|
28991
|
-
while (i--) if (siblings[i].operation && siblings[i].operation.type ===
|
|
29112
|
+
while (i--) if (siblings[i].operation && siblings[i].operation.type === 14) {
|
|
28992
29113
|
lastIfNode = siblings[i].operation;
|
|
28993
29114
|
break;
|
|
28994
29115
|
}
|
|
28995
29116
|
}
|
|
28996
|
-
if (!siblingIf || !lastIfNode || lastIfNode.type !==
|
|
29117
|
+
if (!siblingIf || !lastIfNode || lastIfNode.type !== 14) {
|
|
28997
29118
|
context.options.onError(createCompilerError(30, node.loc));
|
|
28998
29119
|
return;
|
|
28999
29120
|
}
|
|
29000
|
-
while (lastIfNode.negative && lastIfNode.negative.type ===
|
|
29121
|
+
while (lastIfNode.negative && lastIfNode.negative.type === 14) lastIfNode = lastIfNode.negative;
|
|
29001
29122
|
if (dir.name === "else-if" && lastIfNode.negative) context.options.onError(createCompilerError(30, node.loc));
|
|
29002
29123
|
const comments = context.comment;
|
|
29003
29124
|
if (comments.length) {
|
|
@@ -29010,7 +29131,7 @@ function processIf(node, dir, context) {
|
|
|
29010
29131
|
const [branch, onExit] = createIfBranch(node, context);
|
|
29011
29132
|
if (dir.name === "else") lastIfNode.negative = branch;
|
|
29012
29133
|
else lastIfNode.negative = {
|
|
29013
|
-
type:
|
|
29134
|
+
type: 14,
|
|
29014
29135
|
id: -1,
|
|
29015
29136
|
condition: dir.exp,
|
|
29016
29137
|
positive: branch,
|
|
@@ -29020,7 +29141,7 @@ function processIf(node, dir, context) {
|
|
|
29020
29141
|
};
|
|
29021
29142
|
return () => {
|
|
29022
29143
|
onExit();
|
|
29023
|
-
if (lastIfNode.negative.type ===
|
|
29144
|
+
if (lastIfNode.negative.type === 14) lastIfNode.negative.blockShape = encodeIfBlockShape(lastIfNode.negative.positive, forceMultiRoot, void 0, allowNoScope);
|
|
29024
29145
|
lastIfNode.blockShape = encodeIfBlockShape(lastIfNode.positive, forceMultiRoot, lastIfNode.negative, allowNoScope);
|
|
29025
29146
|
};
|
|
29026
29147
|
}
|
|
@@ -29039,12 +29160,12 @@ function createIfBranch(node, context) {
|
|
|
29039
29160
|
function encodeIfBlockShape(positive, forceMultiRoot = false, negative, allowNoScope = true) {
|
|
29040
29161
|
if (forceMultiRoot) return 10;
|
|
29041
29162
|
const positiveNoScope = allowNoScope && canSkipIfBranchScope(positive);
|
|
29042
|
-
const negativeNoScope = allowNoScope && negative && negative.type !==
|
|
29163
|
+
const negativeNoScope = allowNoScope && negative && negative.type !== 14 && canSkipIfBranchScope(negative);
|
|
29043
29164
|
return getBlockShape(positive) | getNegativeIfBranchShape(negative) << 2 | (positiveNoScope ? 32 : 0) | (negativeNoScope ? 64 : 0);
|
|
29044
29165
|
}
|
|
29045
29166
|
function getNegativeIfBranchShape(negative) {
|
|
29046
29167
|
if (!negative) return 0;
|
|
29047
|
-
return negative.type ===
|
|
29168
|
+
return negative.type === 14 ? 1 : getBlockShape(negative);
|
|
29048
29169
|
}
|
|
29049
29170
|
function canSkipIfBranchScope(block) {
|
|
29050
29171
|
if (block.effect.length || block.operation.length) return false;
|
|
@@ -29101,7 +29222,7 @@ function processFor(node, dir, context) {
|
|
|
29101
29222
|
const { parent } = context;
|
|
29102
29223
|
const isOnlyChild = parent && parent.block.node !== parent.node && parent.node.children.length === 1;
|
|
29103
29224
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
29104
|
-
type:
|
|
29225
|
+
type: 15,
|
|
29105
29226
|
id
|
|
29106
29227
|
}, context.effectBoundary()), {}, {
|
|
29107
29228
|
source,
|
|
@@ -29149,7 +29270,7 @@ const transformSlotOutlet = (node, context) => {
|
|
|
29149
29270
|
if (slotProps.length) {
|
|
29150
29271
|
const [isDynamic, props] = buildProps(extend({}, node, { props: slotProps }), context, true);
|
|
29151
29272
|
irProps = isDynamic ? props : [props];
|
|
29152
|
-
const runtimeDirective = context.block.operation.find((oper) => oper.type ===
|
|
29273
|
+
const runtimeDirective = context.block.operation.find((oper) => oper.type === 13 && oper.element === id);
|
|
29153
29274
|
if (runtimeDirective) context.options.onError(createCompilerError(36, runtimeDirective.dir.loc));
|
|
29154
29275
|
}
|
|
29155
29276
|
return () => {
|
|
@@ -29158,7 +29279,7 @@ const transformSlotOutlet = (node, context) => {
|
|
|
29158
29279
|
if (context.options.scopeId && !context.options.slotted) flags |= 1;
|
|
29159
29280
|
if (context.inVOnce) flags |= 2;
|
|
29160
29281
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
29161
|
-
type:
|
|
29282
|
+
type: 12,
|
|
29162
29283
|
id
|
|
29163
29284
|
}, context.effectBoundary()), {}, {
|
|
29164
29285
|
name: slotName,
|
|
@@ -29358,7 +29479,7 @@ const transformKey = (node, context) => {
|
|
|
29358
29479
|
return () => {
|
|
29359
29480
|
exitBlock();
|
|
29360
29481
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
29361
|
-
type:
|
|
29482
|
+
type: 16,
|
|
29362
29483
|
id
|
|
29363
29484
|
}, context.effectBoundary()), {}, {
|
|
29364
29485
|
value,
|
|
@@ -29726,6 +29847,7 @@ const ssrTransformElement = (node, context) => {
|
|
|
29726
29847
|
else {
|
|
29727
29848
|
attrName = node.tag.indexOf("-") > 0 ? attrName : propsToAttrMap[attrName] || attrName.toLowerCase();
|
|
29728
29849
|
if (isBooleanAttr(attrName)) openTag.push(createConditionalExpression(createCallExpression(context.helper(SSR_INCLUDE_BOOLEAN_ATTR), [value]), createSimpleExpression(" " + attrName, true), createSimpleExpression("", true), false));
|
|
29850
|
+
else if (attrName === "hidden") openTag.push(createCallExpression(context.helper(SSR_RENDER_DYNAMIC_ATTR), [key, value]));
|
|
29729
29851
|
else if (isSSRSafeAttrName(attrName)) openTag.push(createCallExpression(context.helper(SSR_RENDER_ATTR), [key, value]));
|
|
29730
29852
|
else context.onError(createSSRCompilerError(65, key.loc));
|
|
29731
29853
|
}
|
|
@@ -30378,10 +30500,12 @@ function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ast:
|
|
|
30378
30500
|
const defaultCompiler = ssr ? src_exports : vapor ? src_exports$1 : src_exports$2;
|
|
30379
30501
|
compiler = compiler || defaultCompiler;
|
|
30380
30502
|
if (compiler !== defaultCompiler) inAST = void 0;
|
|
30381
|
-
|
|
30382
|
-
|
|
30503
|
+
inAST = resolveTemplateAST(inAST, {
|
|
30504
|
+
compiler,
|
|
30505
|
+
compilerOptions,
|
|
30506
|
+
ssr,
|
|
30383
30507
|
onError: (e) => errors.push(e)
|
|
30384
|
-
})
|
|
30508
|
+
});
|
|
30385
30509
|
let { code, ast, preamble, map, helpers } = compiler.compile(inAST || source, _objectSpread2(_objectSpread2({
|
|
30386
30510
|
mode: "module",
|
|
30387
30511
|
prefixIdentifiers: true,
|
|
@@ -41390,7 +41514,13 @@ function resolveTypeReference(ctx, node, scope, name, onlyExported = false) {
|
|
|
41390
41514
|
return node._resolvedReference;
|
|
41391
41515
|
}
|
|
41392
41516
|
const resolved = innerResolveTypeReference(ctx, scope || ctxToScope(ctx), name || getReferenceName(node), node, onlyExported);
|
|
41393
|
-
|
|
41517
|
+
if (canCache) Object.defineProperty(node, "_resolvedReference", {
|
|
41518
|
+
value: resolved,
|
|
41519
|
+
writable: true,
|
|
41520
|
+
configurable: true,
|
|
41521
|
+
enumerable: false
|
|
41522
|
+
});
|
|
41523
|
+
return resolved;
|
|
41394
41524
|
}
|
|
41395
41525
|
function innerResolveTypeReference(ctx, scope, name, node, onlyExported) {
|
|
41396
41526
|
if (typeof name === "string") if (scope.imports[name]) return resolveTypeFromImport(ctx, node, name, scope);
|
|
@@ -42612,7 +42742,7 @@ function compileScript(sfc, options) {
|
|
|
42612
42742
|
}
|
|
42613
42743
|
function registerUserImport(source, local, imported, isType, isFromSetup, needTemplateUsageCheck) {
|
|
42614
42744
|
let isImportUsed = needTemplateUsageCheck;
|
|
42615
|
-
if (needTemplateUsageCheck && ctx.isTS && sfc.template && !sfc.template.src && !sfc.template.lang) isImportUsed = isUsedInTemplate(local, sfc);
|
|
42745
|
+
if (needTemplateUsageCheck && ctx.isTS && sfc.template && !sfc.template.src && !sfc.template.lang) isImportUsed = isUsedInTemplate(local, sfc, options.templateOptions);
|
|
42616
42746
|
ctx.userImports[local] = {
|
|
42617
42747
|
isType,
|
|
42618
42748
|
imported,
|
|
@@ -42815,7 +42945,7 @@ function compileScript(sfc, options) {
|
|
|
42815
42945
|
for (const key in scriptBindings) ctx.bindingMetadata[key] = scriptBindings[key];
|
|
42816
42946
|
for (const key in setupBindings) ctx.bindingMetadata[key] = setupBindings[key];
|
|
42817
42947
|
if (sfc.template && !sfc.template.src && sfc.template.ast) {
|
|
42818
|
-
const vModelIds = resolveTemplateVModelIdentifiers(sfc);
|
|
42948
|
+
const vModelIds = resolveTemplateVModelIdentifiers(sfc, options.templateOptions);
|
|
42819
42949
|
if (vModelIds.size) {
|
|
42820
42950
|
const toDemote = /* @__PURE__ */ new Set();
|
|
42821
42951
|
for (const id of vModelIds) if (setupBindings[id] === "setup-reactive-const") toDemote.add(id);
|
|
@@ -43072,7 +43202,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
43072
43202
|
//#endregion
|
|
43073
43203
|
//#region packages/compiler-sfc/src/index.ts
|
|
43074
43204
|
init_objectSpread2();
|
|
43075
|
-
const version = "3.6.0-rc.
|
|
43205
|
+
const version = "3.6.0-rc.3";
|
|
43076
43206
|
const parseCache = parseCache$1;
|
|
43077
43207
|
const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
|
|
43078
43208
|
const walk = walk$2;
|