@dcloudio/uni-cli-shared 3.0.0-alpha-5000720260416001 → 3.0.0-alpha-5000820260420001
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/constants.d.ts +1 -3
- package/dist/constants.js +2 -6
- package/dist/deps.d.ts +1 -0
- package/dist/deps.js +22 -13
- package/dist/dom2/fontFamily.d.ts +4 -0
- package/dist/dom2/fontFamily.js +21 -0
- package/dist/dom2/index.d.ts +2 -0
- package/dist/dom2/index.js +2 -0
- package/dist/dom2/sharedData.d.ts +4 -0
- package/dist/dom2/sharedData.js +38 -5
- package/dist/dom2/vue.d.ts +15 -0
- package/dist/dom2/vue.js +41 -0
- package/dist/easycom.js +13 -9
- package/dist/env/define.d.ts +0 -1
- package/dist/env/define.js +3 -11
- package/dist/hbx/alias.js +48 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/json/uni-x/manifest.d.ts +1 -1
- package/dist/json/uni-x/manifest.js +2 -1
- package/dist/json/utils.js +24 -0
- package/dist/messages/en.d.ts +2 -0
- package/dist/messages/en.js +2 -0
- package/dist/messages/index.d.ts +4 -0
- package/dist/messages/zh_CN.d.ts +2 -0
- package/dist/messages/zh_CN.js +2 -0
- package/dist/uni_modules.cloud.js +28 -13
- package/dist/uni_modules.js +3 -2
- package/dist/uts.js +4 -2
- package/dist/vite/autoImport.js +7 -4
- package/dist/vite/cloud.js +13 -6
- package/dist/vite/extApi.js +4 -1
- package/dist/vite/plugins/json.js +2 -69
- package/dist/vite/plugins/stats.js +2 -1
- package/dist/vite/plugins/uts/uni_modules.js +7 -2
- package/dist/vite/plugins/vitejs/plugins/css.js +6 -4
- package/dist/workers.js +2 -0
- package/dist/x.d.ts +10 -0
- package/dist/x.js +39 -0
- package/lib/dom2/app/@vitejs/plugin-vue/dist/index.cjs +0 -7
- package/lib/dom2/app/@vitejs/plugin-vue/dist/index.mjs +0 -7
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.js +1 -1
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.prod.js +1 -1
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.d.ts +1 -0
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.esm-bundler.js +1 -1
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.js +1 -1
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +1 -1
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +1 -1
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +1 -1
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +1 -1
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.js +1 -1
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.prod.js +1 -1
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +348 -120
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +99 -56
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +70 -47
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.d.ts +127 -107
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +70 -48
- package/lib/dom2/app/@vue/compiler-vapor-dom2/dist/compiler-vapor-dom2.cjs.js +1 -1
- package/lib/dom2/app/@vue/shared/dist/shared.cjs.js +1 -1
- package/lib/dom2/app/@vue/shared/dist/shared.cjs.prod.js +1 -1
- package/lib/dom2/app/@vue/shared/dist/shared.esm-bundler.js +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-beta.7
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -24914,7 +24914,7 @@ function wrapTemplate(node, dirs) {
|
|
|
24914
24914
|
const reserved = [];
|
|
24915
24915
|
const pass = [];
|
|
24916
24916
|
node.props.forEach((prop) => {
|
|
24917
|
-
if (prop.type === 7 && dirs.includes(prop.name)) reserved.push(prop);
|
|
24917
|
+
if (prop.type === 7 && (dirs.includes(prop.name) || prop.name === "bind" && prop.arg && prop.arg.type === 4 && prop.arg.content === "key" && dirs.includes("key"))) reserved.push(prop);
|
|
24918
24918
|
else pass.push(prop);
|
|
24919
24919
|
});
|
|
24920
24920
|
return extend({}, node, {
|
|
@@ -24974,13 +24974,6 @@ function getLiteralExpressionValue(exp, excludeNumber) {
|
|
|
24974
24974
|
}
|
|
24975
24975
|
return exp.isStatic ? exp.content : null;
|
|
24976
24976
|
}
|
|
24977
|
-
function isInTransition(context) {
|
|
24978
|
-
const parentNode = context.parent && context.parent.node;
|
|
24979
|
-
return !!(parentNode && isTransitionNode(parentNode));
|
|
24980
|
-
}
|
|
24981
|
-
function isTransitionNode(node) {
|
|
24982
|
-
return node.type === 1 && isTransitionTag(node.tag);
|
|
24983
|
-
}
|
|
24984
24977
|
function isTransitionTag(tag) {
|
|
24985
24978
|
tag = tag.toLowerCase();
|
|
24986
24979
|
return tag === "transition" || tag === "vaportransition";
|
|
@@ -25447,12 +25440,14 @@ const IRNodeTypes = {
|
|
|
25447
25440
|
"14": "IF",
|
|
25448
25441
|
"FOR": 15,
|
|
25449
25442
|
"15": "FOR",
|
|
25450
|
-
"
|
|
25451
|
-
"16": "
|
|
25452
|
-
"
|
|
25453
|
-
"17": "
|
|
25454
|
-
"
|
|
25455
|
-
"18": "
|
|
25443
|
+
"KEY": 16,
|
|
25444
|
+
"16": "KEY",
|
|
25445
|
+
"GET_TEXT_CHILD": 17,
|
|
25446
|
+
"17": "GET_TEXT_CHILD",
|
|
25447
|
+
"GET_INSERTION_PARENT": 18,
|
|
25448
|
+
"18": "GET_INSERTION_PARENT",
|
|
25449
|
+
"SET_CHANGE_PROP": 19,
|
|
25450
|
+
"19": "SET_CHANGE_PROP"
|
|
25456
25451
|
};
|
|
25457
25452
|
const DynamicFlag = {
|
|
25458
25453
|
"NONE": 0,
|
|
@@ -25466,7 +25461,7 @@ const DynamicFlag = {
|
|
|
25466
25461
|
};
|
|
25467
25462
|
function isBlockOperation(op) {
|
|
25468
25463
|
const type = op.type;
|
|
25469
|
-
return type === 11 || type === 12 || type === 14 || type === 15;
|
|
25464
|
+
return type === 11 || type === 12 || type === 14 || type === 16 || type === 15;
|
|
25470
25465
|
}
|
|
25471
25466
|
|
|
25472
25467
|
//#endregion
|
|
@@ -26724,7 +26719,7 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
26724
26719
|
let propsName;
|
|
26725
26720
|
let exitScope;
|
|
26726
26721
|
let depth;
|
|
26727
|
-
const { props,
|
|
26722
|
+
const { props, node } = oper;
|
|
26728
26723
|
const idToPathMap = props ? parseValueDestructure(props, context) : /* @__PURE__ */ new Map();
|
|
26729
26724
|
if (props) if (props.ast) {
|
|
26730
26725
|
[depth, exitScope] = context.enterScope();
|
|
@@ -26734,16 +26729,6 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
26734
26729
|
if (propsName) idMap[propsName] = null;
|
|
26735
26730
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
26736
26731
|
exitScope && exitScope();
|
|
26737
|
-
if (key) blockFn = [
|
|
26738
|
-
`() => {`,
|
|
26739
|
-
INDENT_START,
|
|
26740
|
-
NEWLINE,
|
|
26741
|
-
`return `,
|
|
26742
|
-
...genCall(context.helper("createKeyedFragment"), [`() => `, ...genExpression(key, context)], blockFn),
|
|
26743
|
-
INDENT_END,
|
|
26744
|
-
NEWLINE,
|
|
26745
|
-
`}`
|
|
26746
|
-
];
|
|
26747
26732
|
if (node.type === 1) {
|
|
26748
26733
|
if (needsVaporCtx(oper)) blockFn = [
|
|
26749
26734
|
`${context.helper("withVaporCtx")}(`,
|
|
@@ -26817,6 +26802,20 @@ function genSlotOutlet(oper, context) {
|
|
|
26817
26802
|
return frag;
|
|
26818
26803
|
}
|
|
26819
26804
|
|
|
26805
|
+
//#endregion
|
|
26806
|
+
//#region packages/compiler-vapor/src/generators/key.ts
|
|
26807
|
+
function genKey(oper, context) {
|
|
26808
|
+
const { id, value, block } = oper;
|
|
26809
|
+
const [frag, push] = buildCodeFragment();
|
|
26810
|
+
const blockFn = genBlock(block, context);
|
|
26811
|
+
push(NEWLINE, `const n${id} = `, ...genCall(context.helper("createKeyedFragment"), [
|
|
26812
|
+
`() => (`,
|
|
26813
|
+
...genExpression(value, context),
|
|
26814
|
+
")"
|
|
26815
|
+
], blockFn));
|
|
26816
|
+
return frag;
|
|
26817
|
+
}
|
|
26818
|
+
|
|
26820
26819
|
//#endregion
|
|
26821
26820
|
//#region packages/compiler-vapor/src/generators/operation.ts
|
|
26822
26821
|
function genOperations(opers, context) {
|
|
@@ -26843,12 +26842,13 @@ function genOperation(oper, context) {
|
|
|
26843
26842
|
case 10: return genPrependNode(oper, context);
|
|
26844
26843
|
case 14: return genIf(oper, context);
|
|
26845
26844
|
case 15: return genFor(oper, context);
|
|
26845
|
+
case 16: return genKey(oper, context);
|
|
26846
26846
|
case 11: return genCreateComponent(oper, context);
|
|
26847
26847
|
case 12: return genSlotOutlet(oper, context);
|
|
26848
26848
|
case 13: return genBuiltinDirective(oper, context);
|
|
26849
|
-
case
|
|
26850
|
-
case 17: return [];
|
|
26849
|
+
case 17: return genGetTextChild(oper, context);
|
|
26851
26850
|
case 18: return [];
|
|
26851
|
+
case 19: return [];
|
|
26852
26852
|
default:
|
|
26853
26853
|
const exhaustiveCheck = oper;
|
|
26854
26854
|
throw new Error(`Unhandled operation type in genOperation: ${exhaustiveCheck}`);
|
|
@@ -27336,11 +27336,13 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
27336
27336
|
let template = "";
|
|
27337
27337
|
template += `<${tag}`;
|
|
27338
27338
|
if (scopeId) template += ` ${scopeId}`;
|
|
27339
|
-
if (isDom2
|
|
27340
|
-
template += ` gen-
|
|
27341
|
-
|
|
27342
|
-
|
|
27343
|
-
|
|
27339
|
+
if (isDom2) {
|
|
27340
|
+
if (context.effectiveParent === context.root) template += ` gen-vue-id=""`;
|
|
27341
|
+
if (singleRoot) {
|
|
27342
|
+
template += ` gen-flag-flatten=""`;
|
|
27343
|
+
const rootElementTagName = context.options.rootElementTagName;
|
|
27344
|
+
if (rootElementTagName) template += ` custom-tag-name="${rootElementTagName}"`;
|
|
27345
|
+
}
|
|
27344
27346
|
}
|
|
27345
27347
|
const dynamicProps = [];
|
|
27346
27348
|
if (propsResult[0]) {
|
|
@@ -27386,7 +27388,7 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
27386
27388
|
dynamicProps.push(key.content);
|
|
27387
27389
|
values[0].isStatic = false;
|
|
27388
27390
|
context.registerEffect(values, {
|
|
27389
|
-
type:
|
|
27391
|
+
type: 19,
|
|
27390
27392
|
node,
|
|
27391
27393
|
prop
|
|
27392
27394
|
}, getEffectIndex);
|
|
@@ -27608,7 +27610,7 @@ const transformVText = (dir, node, context) => {
|
|
|
27608
27610
|
context.childrenTemplate = [context.options.platform ? TEXT_PLACEHOLDER : " "];
|
|
27609
27611
|
const isComponent = node.tagType === 1;
|
|
27610
27612
|
if (!isComponent) context.registerOperation({
|
|
27611
|
-
type:
|
|
27613
|
+
type: 17,
|
|
27612
27614
|
node,
|
|
27613
27615
|
parent: context.reference()
|
|
27614
27616
|
});
|
|
@@ -27843,7 +27845,7 @@ function processTextContainer(children, context) {
|
|
|
27843
27845
|
else {
|
|
27844
27846
|
context.childrenTemplate = [context.options.platform ? TEXT_PLACEHOLDER : " "];
|
|
27845
27847
|
context.registerOperation({
|
|
27846
|
-
type:
|
|
27848
|
+
type: 17,
|
|
27847
27849
|
node: context.node,
|
|
27848
27850
|
parent: context.reference()
|
|
27849
27851
|
});
|
|
@@ -27988,7 +27990,7 @@ function processIf(node, dir, context) {
|
|
|
27988
27990
|
id,
|
|
27989
27991
|
condition: dir.exp,
|
|
27990
27992
|
positive: branch,
|
|
27991
|
-
index:
|
|
27993
|
+
index: context.root.nextIfIndex(),
|
|
27992
27994
|
once: context.inVOnce || isStaticExpression(dir.exp, context.options.bindingMetadata)
|
|
27993
27995
|
};
|
|
27994
27996
|
};
|
|
@@ -28022,7 +28024,7 @@ function processIf(node, dir, context) {
|
|
|
28022
28024
|
id: -1,
|
|
28023
28025
|
condition: dir.exp,
|
|
28024
28026
|
positive: branch,
|
|
28025
|
-
index:
|
|
28027
|
+
index: context.root.nextIfIndex(),
|
|
28026
28028
|
once: context.inVOnce || isStaticExpression(dir.exp, context.options.bindingMetadata)
|
|
28027
28029
|
};
|
|
28028
28030
|
return () => onExit();
|
|
@@ -28059,7 +28061,7 @@ function processFor(node, dir, context) {
|
|
|
28059
28061
|
const typeProp = findProp(node, "type");
|
|
28060
28062
|
const typeProperty = typeProp && propToExpression(typeProp);
|
|
28061
28063
|
const isComponent = node.tagType === 1 || isTemplateWithSingleComponent(node);
|
|
28062
|
-
context.node = node = wrapTemplate(node, ["for"]);
|
|
28064
|
+
context.node = node = wrapTemplate(node, ["for", "key"]);
|
|
28063
28065
|
context.dynamic.flags |= 6;
|
|
28064
28066
|
const id = context.reference();
|
|
28065
28067
|
const render = newBlock(node);
|
|
@@ -28176,13 +28178,6 @@ function transformComponentSlot(node, dir, context) {
|
|
|
28176
28178
|
markNonTemplate(n, context);
|
|
28177
28179
|
});
|
|
28178
28180
|
const [block, onExit] = createSlotBlock(node, dir, context);
|
|
28179
|
-
if (isTransitionNode(node) && nonSlotTemplateChildren.length) {
|
|
28180
|
-
const nonCommentChild = nonSlotTemplateChildren.find((n) => !isCommentOrWhitespace(n));
|
|
28181
|
-
if (nonCommentChild) {
|
|
28182
|
-
const keyProp = findProp(nonCommentChild, "key");
|
|
28183
|
-
if (keyProp) block.key = keyProp.exp;
|
|
28184
|
-
}
|
|
28185
|
-
}
|
|
28186
28181
|
const { slots } = context;
|
|
28187
28182
|
return () => {
|
|
28188
28183
|
onExit();
|
|
@@ -28301,6 +28296,32 @@ function hasMultipleChildren(node) {
|
|
|
28301
28296
|
return children.length > 1;
|
|
28302
28297
|
}
|
|
28303
28298
|
|
|
28299
|
+
//#endregion
|
|
28300
|
+
//#region packages/compiler-vapor/src/transforms/transformKey.ts
|
|
28301
|
+
const transformKey = (node, context) => {
|
|
28302
|
+
if (node.type !== 1 || context.inVOnce || findDir(node, "for")) return;
|
|
28303
|
+
const dir = findProp(node, "key", true, true);
|
|
28304
|
+
if (!dir || dir.type === 6) return;
|
|
28305
|
+
let value;
|
|
28306
|
+
value = dir.exp || normalizeBindShorthand(dir.arg, context);
|
|
28307
|
+
if (isStaticExpression(value, context.options.bindingMetadata)) return;
|
|
28308
|
+
let id = context.reference();
|
|
28309
|
+
context.dynamic.flags |= 6;
|
|
28310
|
+
context.node = node = wrapTemplate(node, ["key"]);
|
|
28311
|
+
const block = newBlock(node);
|
|
28312
|
+
const exitBlock = context.enterBlock(block);
|
|
28313
|
+
return () => {
|
|
28314
|
+
exitBlock();
|
|
28315
|
+
context.dynamic.operation = {
|
|
28316
|
+
type: 16,
|
|
28317
|
+
node,
|
|
28318
|
+
id,
|
|
28319
|
+
value,
|
|
28320
|
+
block
|
|
28321
|
+
};
|
|
28322
|
+
};
|
|
28323
|
+
};
|
|
28324
|
+
|
|
28304
28325
|
//#endregion
|
|
28305
28326
|
//#region packages/compiler-vapor/src/compile.ts
|
|
28306
28327
|
function compile$1(source, options = {}) {
|
|
@@ -28325,6 +28346,7 @@ function getBaseTransformPreset() {
|
|
|
28325
28346
|
transformVOnce,
|
|
28326
28347
|
transformVIf,
|
|
28327
28348
|
transformVFor,
|
|
28349
|
+
transformKey,
|
|
28328
28350
|
transformSlotOutlet,
|
|
28329
28351
|
transformTemplateRef,
|
|
28330
28352
|
transformElement,
|
|
@@ -28409,6 +28431,7 @@ var src_exports$1 = /* @__PURE__ */ __exportAll({
|
|
|
28409
28431
|
transformChildren: () => transformChildren,
|
|
28410
28432
|
transformComment: () => transformComment,
|
|
28411
28433
|
transformElement: () => transformElement,
|
|
28434
|
+
transformKey: () => transformKey,
|
|
28412
28435
|
transformSlotOutlet: () => transformSlotOutlet,
|
|
28413
28436
|
transformTemplateRef: () => transformTemplateRef,
|
|
28414
28437
|
transformText: () => transformText,
|
|
@@ -39422,7 +39445,7 @@ function resolveParserPlugins(lang, userPlugins, dts = false) {
|
|
|
39422
39445
|
if (!userPlugins || !userPlugins.some((p) => p === "importAssertions" || p === "importAttributes" || isArray$3(p) && p[0] === "importAttributes")) plugins.push("importAttributes");
|
|
39423
39446
|
if (lang === "jsx" || lang === "tsx" || lang === "mtsx") plugins.push("jsx");
|
|
39424
39447
|
else if (userPlugins) userPlugins = userPlugins.filter((p) => p !== "jsx");
|
|
39425
|
-
if (lang === "uts" || lang === "ts" || lang === "mts" || lang === "tsx" || lang === "mtsx") {
|
|
39448
|
+
if (lang === "uts" || lang === "ts" || lang === "mts" || lang === "tsx" || lang === "cts" || lang === "mtsx") {
|
|
39426
39449
|
plugins.push(["typescript", { dts }], "explicitResourceManagement");
|
|
39427
39450
|
if (!userPlugins || !userPlugins.includes("decorators")) plugins.push("decorators-legacy");
|
|
39428
39451
|
}
|
|
@@ -39926,11 +39949,17 @@ function importSourceToScope(ctx, node, scope, source) {
|
|
|
39926
39949
|
} else return ctx.error(`Failed to resolve import source ${JSON.stringify(source)}.`, node, scope);
|
|
39927
39950
|
}
|
|
39928
39951
|
function resolveExt(filename, fs) {
|
|
39929
|
-
|
|
39952
|
+
let moduleType = "u";
|
|
39953
|
+
if (filename.endsWith(".mjs")) moduleType = "m";
|
|
39954
|
+
else if (filename.endsWith(".cjs")) moduleType = "c";
|
|
39955
|
+
filename = filename.replace(/\.[cm]?jsx?$/, "");
|
|
39930
39956
|
const tryResolve = (filename) => {
|
|
39931
39957
|
if (fs.fileExists(filename)) return filename;
|
|
39932
39958
|
};
|
|
39933
|
-
|
|
39959
|
+
const resolveTs = () => tryResolve(filename + `.uts`) || tryResolve(filename + `.ts`) || tryResolve(filename + `.tsx`) || tryResolve(filename + `.d.ts`);
|
|
39960
|
+
const resolveMts = () => tryResolve(filename + `.mts`) || tryResolve(filename + `.d.mts`);
|
|
39961
|
+
const resolveCts = () => tryResolve(filename + `.cts`) || tryResolve(filename + `.d.cts`);
|
|
39962
|
+
return tryResolve(filename) || (moduleType === "m" ? resolveMts() || resolveTs() : moduleType === "c" ? resolveCts() || resolveTs() : resolveTs() || resolveMts() || resolveCts()) || tryResolve(joinPaths(filename, `index.uts`)) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.tsx`)) || tryResolve(joinPaths(filename, `index.d.ts`));
|
|
39934
39963
|
}
|
|
39935
39964
|
const tsConfigCache = createCache();
|
|
39936
39965
|
const tsConfigRefMap = /* @__PURE__ */ new Map();
|
|
@@ -39958,8 +39987,8 @@ function fileToScope(ctx, filename, asGlobal = false) {
|
|
|
39958
39987
|
}
|
|
39959
39988
|
function parseFile(filename, content, fs, parserPlugins) {
|
|
39960
39989
|
const ext = extname(filename);
|
|
39961
|
-
if (ext === ".uts" || ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".mtsx") return (0, import_lib.parse)(content, {
|
|
39962
|
-
plugins: resolveParserPlugins(ext.slice(1), parserPlugins, /\.d\.
|
|
39990
|
+
if (ext === ".uts" || ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".cts" || ext === ".mtsx") return (0, import_lib.parse)(content, {
|
|
39991
|
+
plugins: resolveParserPlugins(ext.slice(1), parserPlugins, /\.d\.[cm]?ts$/.test(filename)),
|
|
39963
39992
|
sourceType: "module"
|
|
39964
39993
|
}).program.body;
|
|
39965
39994
|
const isUnknownTypeSource = !/\.[cm]?[tj]sx?$/.test(filename);
|
|
@@ -40589,7 +40618,18 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
|
|
|
40589
40618
|
return resolveObjectKey(node.key, node.computed) === key;
|
|
40590
40619
|
});
|
|
40591
40620
|
if (prop) if (prop.type === "ObjectProperty") defaultString = `default: ${ctx.getString(prop.value)}`;
|
|
40592
|
-
else
|
|
40621
|
+
else {
|
|
40622
|
+
let paramsString = "";
|
|
40623
|
+
if (prop.params.length) {
|
|
40624
|
+
const start = prop.params[0].start;
|
|
40625
|
+
const end = prop.params[prop.params.length - 1].end;
|
|
40626
|
+
paramsString = ctx.getString({
|
|
40627
|
+
start,
|
|
40628
|
+
end
|
|
40629
|
+
});
|
|
40630
|
+
}
|
|
40631
|
+
defaultString = `${prop.async ? "async " : ""}${prop.kind !== "method" ? `${prop.kind} ` : ""}default(${paramsString}) ${ctx.getString(prop.body)}`;
|
|
40632
|
+
}
|
|
40593
40633
|
}
|
|
40594
40634
|
const finalKey = getEscapedPropName(key);
|
|
40595
40635
|
if (!ctx.options.isProd) return `${finalKey}: { ${concatStrings([
|
|
@@ -41332,13 +41372,16 @@ function compileScript(sfc, options) {
|
|
|
41332
41372
|
const optionsProps = [];
|
|
41333
41373
|
if (hasScriptCpp) optionsProps.push("scriptCpp: true");
|
|
41334
41374
|
const optionsCode = optionsProps.length ? `, { ${optionsProps.join(", ")} }` : "";
|
|
41375
|
+
const dynamicSharedDataOptionsCode = options.dynamicSharedData ? `_useSharedDataPageOptions({ bundleKey: __className, sharedDataClassId: 0 })` : `_useSharedDataPageOptions()`;
|
|
41376
|
+
const dynamicSharedDataComponentOptionsCode = options.dynamicSharedData ? `_useSharedDataComponentOptions({ bundleKey: __className, sharedDataClassId: 0 })` : `_useSharedDataComponentOptions()`;
|
|
41335
41377
|
if (componentType === "page") {
|
|
41336
41378
|
setupPreambleLines.unshift(`const __sharedDataScope = _useSharedDataScope(__sharedData)`);
|
|
41337
|
-
setupPreambleLines.unshift(`const __sharedData = _withSharedDataPage(useSharedDataPage<__SHARED_DATA_CLASS_NAME_TYPE>(_useSharedDataRenderer() == 'component' ? _useSharedDataScope() : _useSharedDataPageId(),
|
|
41379
|
+
setupPreambleLines.unshift(`const __sharedData = _withSharedDataPage(useSharedDataPage<__SHARED_DATA_CLASS_NAME_TYPE>(_useSharedDataRenderer() == 'component' ? _useSharedDataScope() : _useSharedDataPageId(), ${dynamicSharedDataOptionsCode})${optionsCode})`);
|
|
41338
41380
|
} else if (componentType === "component") {
|
|
41339
|
-
setupPreambleLines.unshift(`const __sharedData = _withSharedDataComponent(useSharedDataComponent<__SHARED_DATA_CLASS_NAME_TYPE>(__sharedDataScope,
|
|
41381
|
+
setupPreambleLines.unshift(`const __sharedData = _withSharedDataComponent(useSharedDataComponent<__SHARED_DATA_CLASS_NAME_TYPE>(__sharedDataScope, ${dynamicSharedDataComponentOptionsCode})${optionsCode})`);
|
|
41340
41382
|
setupPreambleLines.unshift(`const __sharedDataScope = _useSharedDataScope()`);
|
|
41341
41383
|
}
|
|
41384
|
+
if (options.dynamicSharedData) runtimeOptions += `\n __dynamicSharedData: true,`;
|
|
41342
41385
|
if (options.isWatch && templateHash) runtimeOptions += `\n __hash: "${templateHash}",`;
|
|
41343
41386
|
runtimeOptions += `\n __className,`;
|
|
41344
41387
|
runtimeOptions += `\n __filename: '${((_options$templateOpti3 = options.templateOptions) === null || _options$templateOpti3 === void 0 ? void 0 : _options$templateOpti3.compilerOptions).relativeFilename || ""}',`;
|
|
@@ -41509,7 +41552,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
41509
41552
|
//#endregion
|
|
41510
41553
|
//#region packages/compiler-sfc/src/index.ts
|
|
41511
41554
|
init_objectSpread2();
|
|
41512
|
-
const version = "3.6.0-beta.
|
|
41555
|
+
const version = "3.6.0-beta.7";
|
|
41513
41556
|
const parseCache = parseCache$1;
|
|
41514
41557
|
const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
|
|
41515
41558
|
const walk = walk$2;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-beta.7
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -50,7 +50,7 @@ function wrapTemplate(node, dirs) {
|
|
|
50
50
|
const reserved = [];
|
|
51
51
|
const pass = [];
|
|
52
52
|
node.props.forEach((prop) => {
|
|
53
|
-
if (prop.type === 7 && dirs.includes(prop.name)) reserved.push(prop);
|
|
53
|
+
if (prop.type === 7 && (dirs.includes(prop.name) || prop.name === "bind" && prop.arg && prop.arg.type === 4 && prop.arg.content === "key" && dirs.includes("key"))) reserved.push(prop);
|
|
54
54
|
else pass.push(prop);
|
|
55
55
|
});
|
|
56
56
|
return (0, _vue_shared.extend)({}, node, {
|
|
@@ -110,13 +110,6 @@ function getLiteralExpressionValue(exp, excludeNumber) {
|
|
|
110
110
|
}
|
|
111
111
|
return exp.isStatic ? exp.content : null;
|
|
112
112
|
}
|
|
113
|
-
function isInTransition(context) {
|
|
114
|
-
const parentNode = context.parent && context.parent.node;
|
|
115
|
-
return !!(parentNode && isTransitionNode(parentNode));
|
|
116
|
-
}
|
|
117
|
-
function isTransitionNode(node) {
|
|
118
|
-
return node.type === 1 && isTransitionTag(node.tag);
|
|
119
|
-
}
|
|
120
113
|
function isTransitionTag(tag) {
|
|
121
114
|
tag = tag.toLowerCase();
|
|
122
115
|
return tag === "transition" || tag === "vaportransition";
|
|
@@ -583,12 +576,14 @@ const IRNodeTypes = {
|
|
|
583
576
|
"14": "IF",
|
|
584
577
|
"FOR": 15,
|
|
585
578
|
"15": "FOR",
|
|
586
|
-
"
|
|
587
|
-
"16": "
|
|
588
|
-
"
|
|
589
|
-
"17": "
|
|
590
|
-
"
|
|
591
|
-
"18": "
|
|
579
|
+
"KEY": 16,
|
|
580
|
+
"16": "KEY",
|
|
581
|
+
"GET_TEXT_CHILD": 17,
|
|
582
|
+
"17": "GET_TEXT_CHILD",
|
|
583
|
+
"GET_INSERTION_PARENT": 18,
|
|
584
|
+
"18": "GET_INSERTION_PARENT",
|
|
585
|
+
"SET_CHANGE_PROP": 19,
|
|
586
|
+
"19": "SET_CHANGE_PROP"
|
|
592
587
|
};
|
|
593
588
|
const DynamicFlag = {
|
|
594
589
|
"NONE": 0,
|
|
@@ -602,7 +597,7 @@ const DynamicFlag = {
|
|
|
602
597
|
};
|
|
603
598
|
function isBlockOperation(op) {
|
|
604
599
|
const type = op.type;
|
|
605
|
-
return type === 11 || type === 12 || type === 14 || type === 15;
|
|
600
|
+
return type === 11 || type === 12 || type === 14 || type === 16 || type === 15;
|
|
606
601
|
}
|
|
607
602
|
|
|
608
603
|
//#endregion
|
|
@@ -1860,7 +1855,7 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
1860
1855
|
let propsName;
|
|
1861
1856
|
let exitScope;
|
|
1862
1857
|
let depth;
|
|
1863
|
-
const { props,
|
|
1858
|
+
const { props, node } = oper;
|
|
1864
1859
|
const idToPathMap = props ? parseValueDestructure(props, context) : /* @__PURE__ */ new Map();
|
|
1865
1860
|
if (props) if (props.ast) {
|
|
1866
1861
|
[depth, exitScope] = context.enterScope();
|
|
@@ -1870,16 +1865,6 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
1870
1865
|
if (propsName) idMap[propsName] = null;
|
|
1871
1866
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
1872
1867
|
exitScope && exitScope();
|
|
1873
|
-
if (key) blockFn = [
|
|
1874
|
-
`() => {`,
|
|
1875
|
-
INDENT_START,
|
|
1876
|
-
NEWLINE,
|
|
1877
|
-
`return `,
|
|
1878
|
-
...genCall(context.helper("createKeyedFragment"), [`() => `, ...genExpression(key, context)], blockFn),
|
|
1879
|
-
INDENT_END,
|
|
1880
|
-
NEWLINE,
|
|
1881
|
-
`}`
|
|
1882
|
-
];
|
|
1883
1868
|
if (node.type === 1) {
|
|
1884
1869
|
if (needsVaporCtx(oper)) blockFn = [
|
|
1885
1870
|
`${context.helper("withVaporCtx")}(`,
|
|
@@ -1953,6 +1938,20 @@ function genSlotOutlet(oper, context) {
|
|
|
1953
1938
|
return frag;
|
|
1954
1939
|
}
|
|
1955
1940
|
|
|
1941
|
+
//#endregion
|
|
1942
|
+
//#region packages/compiler-vapor/src/generators/key.ts
|
|
1943
|
+
function genKey(oper, context) {
|
|
1944
|
+
const { id, value, block } = oper;
|
|
1945
|
+
const [frag, push] = buildCodeFragment();
|
|
1946
|
+
const blockFn = genBlock(block, context);
|
|
1947
|
+
push(NEWLINE, `const n${id} = `, ...genCall(context.helper("createKeyedFragment"), [
|
|
1948
|
+
`() => (`,
|
|
1949
|
+
...genExpression(value, context),
|
|
1950
|
+
")"
|
|
1951
|
+
], blockFn));
|
|
1952
|
+
return frag;
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1956
1955
|
//#endregion
|
|
1957
1956
|
//#region packages/compiler-vapor/src/generators/operation.ts
|
|
1958
1957
|
function genOperations(opers, context) {
|
|
@@ -1979,12 +1978,13 @@ function genOperation(oper, context) {
|
|
|
1979
1978
|
case 10: return genPrependNode(oper, context);
|
|
1980
1979
|
case 14: return genIf(oper, context);
|
|
1981
1980
|
case 15: return genFor(oper, context);
|
|
1981
|
+
case 16: return genKey(oper, context);
|
|
1982
1982
|
case 11: return genCreateComponent(oper, context);
|
|
1983
1983
|
case 12: return genSlotOutlet(oper, context);
|
|
1984
1984
|
case 13: return genBuiltinDirective(oper, context);
|
|
1985
|
-
case
|
|
1986
|
-
case 17: return [];
|
|
1985
|
+
case 17: return genGetTextChild(oper, context);
|
|
1987
1986
|
case 18: return [];
|
|
1987
|
+
case 19: return [];
|
|
1988
1988
|
default:
|
|
1989
1989
|
const exhaustiveCheck = oper;
|
|
1990
1990
|
throw new Error(`Unhandled operation type in genOperation: ${exhaustiveCheck}`);
|
|
@@ -2472,11 +2472,13 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
2472
2472
|
let template = "";
|
|
2473
2473
|
template += `<${tag}`;
|
|
2474
2474
|
if (scopeId) template += ` ${scopeId}`;
|
|
2475
|
-
if (isDom2
|
|
2476
|
-
template += ` gen-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2475
|
+
if (isDom2) {
|
|
2476
|
+
if (context.effectiveParent === context.root) template += ` gen-vue-id=""`;
|
|
2477
|
+
if (singleRoot) {
|
|
2478
|
+
template += ` gen-flag-flatten=""`;
|
|
2479
|
+
const rootElementTagName = context.options.rootElementTagName;
|
|
2480
|
+
if (rootElementTagName) template += ` custom-tag-name="${rootElementTagName}"`;
|
|
2481
|
+
}
|
|
2480
2482
|
}
|
|
2481
2483
|
const dynamicProps = [];
|
|
2482
2484
|
if (propsResult[0]) {
|
|
@@ -2522,7 +2524,7 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
2522
2524
|
dynamicProps.push(key.content);
|
|
2523
2525
|
values[0].isStatic = false;
|
|
2524
2526
|
context.registerEffect(values, {
|
|
2525
|
-
type:
|
|
2527
|
+
type: 19,
|
|
2526
2528
|
node,
|
|
2527
2529
|
prop
|
|
2528
2530
|
}, getEffectIndex);
|
|
@@ -2769,7 +2771,7 @@ const transformVText = (dir, node, context) => {
|
|
|
2769
2771
|
context.childrenTemplate = [context.options.platform ? TEXT_PLACEHOLDER : " "];
|
|
2770
2772
|
const isComponent = node.tagType === 1;
|
|
2771
2773
|
if (!isComponent) context.registerOperation({
|
|
2772
|
-
type:
|
|
2774
|
+
type: 17,
|
|
2773
2775
|
node,
|
|
2774
2776
|
parent: context.reference()
|
|
2775
2777
|
});
|
|
@@ -3004,7 +3006,7 @@ function processTextContainer(children, context) {
|
|
|
3004
3006
|
else {
|
|
3005
3007
|
context.childrenTemplate = [context.options.platform ? TEXT_PLACEHOLDER : " "];
|
|
3006
3008
|
context.registerOperation({
|
|
3007
|
-
type:
|
|
3009
|
+
type: 17,
|
|
3008
3010
|
node: context.node,
|
|
3009
3011
|
parent: context.reference()
|
|
3010
3012
|
});
|
|
@@ -3149,7 +3151,7 @@ function processIf(node, dir, context) {
|
|
|
3149
3151
|
id,
|
|
3150
3152
|
condition: dir.exp,
|
|
3151
3153
|
positive: branch,
|
|
3152
|
-
index:
|
|
3154
|
+
index: context.root.nextIfIndex(),
|
|
3153
3155
|
once: context.inVOnce || isStaticExpression(dir.exp, context.options.bindingMetadata)
|
|
3154
3156
|
};
|
|
3155
3157
|
};
|
|
@@ -3183,7 +3185,7 @@ function processIf(node, dir, context) {
|
|
|
3183
3185
|
id: -1,
|
|
3184
3186
|
condition: dir.exp,
|
|
3185
3187
|
positive: branch,
|
|
3186
|
-
index:
|
|
3188
|
+
index: context.root.nextIfIndex(),
|
|
3187
3189
|
once: context.inVOnce || isStaticExpression(dir.exp, context.options.bindingMetadata)
|
|
3188
3190
|
};
|
|
3189
3191
|
return () => onExit();
|
|
@@ -3220,7 +3222,7 @@ function processFor(node, dir, context) {
|
|
|
3220
3222
|
const typeProp = findProp$1(node, "type");
|
|
3221
3223
|
const typeProperty = typeProp && propToExpression(typeProp);
|
|
3222
3224
|
const isComponent = node.tagType === 1 || isTemplateWithSingleComponent(node);
|
|
3223
|
-
context.node = node = wrapTemplate(node, ["for"]);
|
|
3225
|
+
context.node = node = wrapTemplate(node, ["for", "key"]);
|
|
3224
3226
|
context.dynamic.flags |= 6;
|
|
3225
3227
|
const id = context.reference();
|
|
3226
3228
|
const render = newBlock(node);
|
|
@@ -3337,13 +3339,6 @@ function transformComponentSlot(node, dir, context) {
|
|
|
3337
3339
|
markNonTemplate(n, context);
|
|
3338
3340
|
});
|
|
3339
3341
|
const [block, onExit] = createSlotBlock(node, dir, context);
|
|
3340
|
-
if (isTransitionNode(node) && nonSlotTemplateChildren.length) {
|
|
3341
|
-
const nonCommentChild = nonSlotTemplateChildren.find((n) => !(0, _vue_compiler_dom.isCommentOrWhitespace)(n));
|
|
3342
|
-
if (nonCommentChild) {
|
|
3343
|
-
const keyProp = findProp$1(nonCommentChild, "key");
|
|
3344
|
-
if (keyProp) block.key = keyProp.exp;
|
|
3345
|
-
}
|
|
3346
|
-
}
|
|
3347
3342
|
const { slots } = context;
|
|
3348
3343
|
return () => {
|
|
3349
3344
|
onExit();
|
|
@@ -3462,6 +3457,32 @@ function hasMultipleChildren(node) {
|
|
|
3462
3457
|
return children.length > 1;
|
|
3463
3458
|
}
|
|
3464
3459
|
|
|
3460
|
+
//#endregion
|
|
3461
|
+
//#region packages/compiler-vapor/src/transforms/transformKey.ts
|
|
3462
|
+
const transformKey = (node, context) => {
|
|
3463
|
+
if (node.type !== 1 || context.inVOnce || findDir$2(node, "for")) return;
|
|
3464
|
+
const dir = findProp$1(node, "key", true, true);
|
|
3465
|
+
if (!dir || dir.type === 6) return;
|
|
3466
|
+
let value;
|
|
3467
|
+
value = dir.exp || normalizeBindShorthand(dir.arg, context);
|
|
3468
|
+
if (isStaticExpression(value, context.options.bindingMetadata)) return;
|
|
3469
|
+
let id = context.reference();
|
|
3470
|
+
context.dynamic.flags |= 6;
|
|
3471
|
+
context.node = node = wrapTemplate(node, ["key"]);
|
|
3472
|
+
const block = newBlock(node);
|
|
3473
|
+
const exitBlock = context.enterBlock(block);
|
|
3474
|
+
return () => {
|
|
3475
|
+
exitBlock();
|
|
3476
|
+
context.dynamic.operation = {
|
|
3477
|
+
type: 16,
|
|
3478
|
+
node,
|
|
3479
|
+
id,
|
|
3480
|
+
value,
|
|
3481
|
+
block
|
|
3482
|
+
};
|
|
3483
|
+
};
|
|
3484
|
+
};
|
|
3485
|
+
|
|
3465
3486
|
//#endregion
|
|
3466
3487
|
//#region packages/compiler-vapor/src/compile.ts
|
|
3467
3488
|
function compile(source, options = {}) {
|
|
@@ -3486,6 +3507,7 @@ function getBaseTransformPreset() {
|
|
|
3486
3507
|
transformVOnce,
|
|
3487
3508
|
transformVIf,
|
|
3488
3509
|
transformVFor,
|
|
3510
|
+
transformKey,
|
|
3489
3511
|
transformSlotOutlet,
|
|
3490
3512
|
transformTemplateRef,
|
|
3491
3513
|
transformElement,
|
|
@@ -3568,6 +3590,7 @@ exports.transform = transform;
|
|
|
3568
3590
|
exports.transformChildren = transformChildren;
|
|
3569
3591
|
exports.transformComment = transformComment;
|
|
3570
3592
|
exports.transformElement = transformElement;
|
|
3593
|
+
exports.transformKey = transformKey;
|
|
3571
3594
|
exports.transformSlotOutlet = transformSlotOutlet;
|
|
3572
3595
|
exports.transformTemplateRef = transformTemplateRef;
|
|
3573
3596
|
exports.transformText = transformText;
|