@vue/compiler-sfc 3.6.0-rc.1 → 3.6.0-rc.2
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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-rc.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -15812,7 +15812,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
15812
15812
|
}
|
|
15813
15813
|
//#endregion
|
|
15814
15814
|
//#region packages/compiler-sfc/src/index.ts
|
|
15815
|
-
const version = "3.6.0-rc.
|
|
15815
|
+
const version = "3.6.0-rc.2";
|
|
15816
15816
|
const parseCache = parseCache$1;
|
|
15817
15817
|
const errorMessages = {
|
|
15818
15818
|
..._vue_compiler_dom.errorMessages,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-rc.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -17630,7 +17630,7 @@ function getSelfName(filename) {
|
|
|
17630
17630
|
const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
|
|
17631
17631
|
return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
|
|
17632
17632
|
}
|
|
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,
|
|
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, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
|
|
17634
17634
|
const context = {
|
|
17635
17635
|
filename,
|
|
17636
17636
|
selfName: getSelfName(filename),
|
|
@@ -17652,7 +17652,6 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
17652
17652
|
bindingMetadata,
|
|
17653
17653
|
inline,
|
|
17654
17654
|
isTS,
|
|
17655
|
-
eventDelegation,
|
|
17656
17655
|
onError,
|
|
17657
17656
|
onWarn,
|
|
17658
17657
|
compatConfig,
|
|
@@ -21966,6 +21965,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
21966
21965
|
const eventOptionModifiers = [];
|
|
21967
21966
|
for (let i = 0; i < modifiers.length; i++) {
|
|
21968
21967
|
const modifier = modifiers[i].content;
|
|
21968
|
+
if (modifier === "delegate") {
|
|
21969
|
+
if (context) {
|
|
21970
|
+
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
|
|
21971
|
+
error.loc = modifiers[i].loc;
|
|
21972
|
+
context.onWarn(error);
|
|
21973
|
+
}
|
|
21974
|
+
continue;
|
|
21975
|
+
}
|
|
21969
21976
|
if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
|
|
21970
21977
|
else {
|
|
21971
21978
|
const keyString = isString$1(key) ? key : isStaticExp(key) ? key.content : null;
|
|
@@ -25176,7 +25183,6 @@ const defaultOptions = {
|
|
|
25176
25183
|
bindingMetadata: EMPTY_OBJ,
|
|
25177
25184
|
inline: false,
|
|
25178
25185
|
isTS: false,
|
|
25179
|
-
eventDelegation: true,
|
|
25180
25186
|
onError: defaultOnError,
|
|
25181
25187
|
onWarn: defaultOnWarn
|
|
25182
25188
|
};
|
|
@@ -25855,16 +25861,14 @@ function genDeclarations(declarations, context, shouldDeclare) {
|
|
|
25855
25861
|
const varNames = /* @__PURE__ */ new Set();
|
|
25856
25862
|
declarations.forEach(({ name, isIdentifier, value }) => {
|
|
25857
25863
|
if (isIdentifier) {
|
|
25858
|
-
const varName = ids[name] = `_${name}
|
|
25859
|
-
varNames.add(varName);
|
|
25864
|
+
const varName = ids[name] = context.getUniqueLocalName(`_${name}`, varNames);
|
|
25860
25865
|
if (shouldDeclare) push(`const `);
|
|
25861
25866
|
push(`${varName} = `, ...genExpression(value, context), NEWLINE);
|
|
25862
25867
|
}
|
|
25863
25868
|
});
|
|
25864
25869
|
declarations.forEach(({ name, isIdentifier, value }) => {
|
|
25865
25870
|
if (!isIdentifier) {
|
|
25866
|
-
const varName = `_${name}
|
|
25867
|
-
varNames.add(varName);
|
|
25871
|
+
const varName = context.getUniqueLocalName(`_${name}`, varNames);
|
|
25868
25872
|
if (shouldDeclare) push(`const `);
|
|
25869
25873
|
push(`${varName} = `, ...context.withId(() => genExpression(value, context), ids), NEWLINE);
|
|
25870
25874
|
ids[name] = varName;
|
|
@@ -27672,11 +27676,28 @@ var CodegenContext = class {
|
|
|
27672
27676
|
enterScope() {
|
|
27673
27677
|
return [this.scopeLevel++, () => this.scopeLevel--];
|
|
27674
27678
|
}
|
|
27675
|
-
|
|
27676
|
-
|
|
27679
|
+
getUniqueLocalName(base, scopeNames) {
|
|
27680
|
+
const name = this.findAvailableName(base, scopeNames);
|
|
27681
|
+
scopeNames.add(name);
|
|
27682
|
+
this.generatedLocalNames.add(name);
|
|
27683
|
+
return name;
|
|
27684
|
+
}
|
|
27685
|
+
isNameAvailable(name, reservedNames) {
|
|
27686
|
+
if (this.bindingNames.has(name) || reservedNames.has(name)) return false;
|
|
27677
27687
|
for (const alias of this.helpers.values()) if (alias === name) return false;
|
|
27678
27688
|
return true;
|
|
27679
27689
|
}
|
|
27690
|
+
findAvailableName(base, reservedNames) {
|
|
27691
|
+
if (this.isNameAvailable(base, reservedNames)) return base;
|
|
27692
|
+
const map = this.nextIdMap.get(base);
|
|
27693
|
+
let next = 1;
|
|
27694
|
+
while (true) {
|
|
27695
|
+
const id = getNextId(map, next);
|
|
27696
|
+
const name = `${base}${id}`;
|
|
27697
|
+
if (this.isNameAvailable(name, reservedNames)) return name;
|
|
27698
|
+
next = id + 1;
|
|
27699
|
+
}
|
|
27700
|
+
}
|
|
27680
27701
|
initNextIdMap() {
|
|
27681
27702
|
if (this.bindingNames.size === 0) return;
|
|
27682
27703
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -27716,20 +27737,9 @@ var CodegenContext = class {
|
|
|
27716
27737
|
this.helper = (name) => {
|
|
27717
27738
|
if (this.helpers.has(name)) return this.helpers.get(name);
|
|
27718
27739
|
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
|
-
}
|
|
27740
|
+
const alias = this.findAvailableName(base, this.generatedLocalNames);
|
|
27741
|
+
this.helpers.set(name, alias);
|
|
27742
|
+
return alias;
|
|
27733
27743
|
};
|
|
27734
27744
|
this.delegates = /* @__PURE__ */ new Set();
|
|
27735
27745
|
this.identifiers = Object.create(null);
|
|
@@ -27739,6 +27749,7 @@ var CodegenContext = class {
|
|
|
27739
27749
|
this.templateVars = /* @__PURE__ */ new Map();
|
|
27740
27750
|
this.nextIdMap = /* @__PURE__ */ new Map();
|
|
27741
27751
|
this.lastIdMap = /* @__PURE__ */ new Map();
|
|
27752
|
+
this.generatedLocalNames = /* @__PURE__ */ new Set();
|
|
27742
27753
|
this.lastTIndex = -1;
|
|
27743
27754
|
const defaultOptions = {
|
|
27744
27755
|
mode: "module",
|
|
@@ -28754,6 +28765,16 @@ const transformVOn = (dir, node, context) => {
|
|
|
28754
28765
|
const isComponent = node.tagType === 1;
|
|
28755
28766
|
const isSlotOutlet = node.tag === "slot";
|
|
28756
28767
|
if (!exp && !modifiers.length) context.options.onError(createCompilerError(35, loc));
|
|
28768
|
+
let delegateModifier;
|
|
28769
|
+
let nonDelegateModifiers;
|
|
28770
|
+
for (let i = 0; i < modifiers.length; i++) {
|
|
28771
|
+
const modifier = modifiers[i];
|
|
28772
|
+
if (modifier.content === "delegate") {
|
|
28773
|
+
delegateModifier || (delegateModifier = modifier);
|
|
28774
|
+
nonDelegateModifiers || (nonDelegateModifiers = modifiers.slice(0, i));
|
|
28775
|
+
} else if (nonDelegateModifiers) nonDelegateModifiers.push(modifier);
|
|
28776
|
+
}
|
|
28777
|
+
if (nonDelegateModifiers) modifiers = nonDelegateModifiers;
|
|
28757
28778
|
arg = resolveExpression(arg);
|
|
28758
28779
|
if (arg.isStatic && arg.content.startsWith("vue:")) arg = extend({}, arg, { content: `vnode-${arg.content.slice(4)}` });
|
|
28759
28780
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(arg.isStatic ? `on${arg.content}` : arg, modifiers, null, loc);
|
|
@@ -28766,17 +28787,24 @@ const transformVOn = (dir, node, context) => {
|
|
|
28766
28787
|
}
|
|
28767
28788
|
arg = normalizeStaticEventArg(arg, nonKeyModifiers);
|
|
28768
28789
|
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
|
-
|
|
28790
|
+
if (isComponent || isSlotOutlet) {
|
|
28791
|
+
if (delegateModifier) warnDelegate(context, delegateModifier, ".delegate modifier is only supported on native DOM elements. The modifier will be ignored.");
|
|
28792
|
+
return {
|
|
28793
|
+
key: arg,
|
|
28794
|
+
value: exp || EMPTY_EXPRESSION,
|
|
28795
|
+
handler: true,
|
|
28796
|
+
handlerModifiers: {
|
|
28797
|
+
keys: keyModifiers,
|
|
28798
|
+
nonKeys: nonKeyModifiers,
|
|
28799
|
+
options: eventOptionModifiers
|
|
28800
|
+
}
|
|
28801
|
+
};
|
|
28802
|
+
}
|
|
28803
|
+
const isDelegatableEvent = !!delegateModifier && arg.isStatic && delegatedEvents(arg.content);
|
|
28804
|
+
const hasStopHandler = isDelegatableEvent && !eventOptionModifiers.length && hasStopHandlerForStaticEvent(node, arg.content);
|
|
28805
|
+
if (delegateModifier && !arg.isStatic) warnDelegate(context, delegateModifier, ".delegate modifier requires a static event name. The listener will be attached directly.");
|
|
28806
|
+
else if (delegateModifier && !isDelegatableEvent) warnDelegate(context, delegateModifier, `.delegate modifier is not supported on the "${arg.content}" event. The listener will be attached directly.`);
|
|
28807
|
+
const delegate = isDelegatableEvent && !eventOptionModifiers.length && !hasStopHandler;
|
|
28780
28808
|
const operation = {
|
|
28781
28809
|
type: 6,
|
|
28782
28810
|
element: context.reference(),
|
|
@@ -28810,6 +28838,11 @@ function hasStopHandlerForStaticEvent(node, eventName) {
|
|
|
28810
28838
|
return nonKeyModifiers.includes("stop") && normalizeStaticEventArg(arg, nonKeyModifiers).content === eventName;
|
|
28811
28839
|
});
|
|
28812
28840
|
}
|
|
28841
|
+
function warnDelegate(context, modifier, message) {
|
|
28842
|
+
const error = new SyntaxError(message);
|
|
28843
|
+
error.loc = modifier.loc;
|
|
28844
|
+
context.options.onWarn(error);
|
|
28845
|
+
}
|
|
28813
28846
|
//#endregion
|
|
28814
28847
|
//#region packages/compiler-vapor/src/transforms/vShow.ts
|
|
28815
28848
|
const transformVShow = (dir, node, context) => {
|
|
@@ -43072,7 +43105,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
43072
43105
|
//#endregion
|
|
43073
43106
|
//#region packages/compiler-sfc/src/index.ts
|
|
43074
43107
|
init_objectSpread2();
|
|
43075
|
-
const version = "3.6.0-rc.
|
|
43108
|
+
const version = "3.6.0-rc.2";
|
|
43076
43109
|
const parseCache = parseCache$1;
|
|
43077
43110
|
const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
|
|
43078
43111
|
const walk = walk$2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.6.0-rc.
|
|
3
|
+
"version": "3.6.0-rc.2",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"magic-string": "^0.30.21",
|
|
48
48
|
"postcss": "^8.5.19",
|
|
49
49
|
"source-map-js": "^1.2.1",
|
|
50
|
-
"@vue/compiler-
|
|
51
|
-
"@vue/compiler-
|
|
52
|
-
"@vue/compiler-
|
|
53
|
-
"@vue/
|
|
54
|
-
"@vue/
|
|
50
|
+
"@vue/compiler-ssr": "3.6.0-rc.2",
|
|
51
|
+
"@vue/compiler-core": "3.6.0-rc.2",
|
|
52
|
+
"@vue/compiler-vapor": "3.6.0-rc.2",
|
|
53
|
+
"@vue/compiler-dom": "3.6.0-rc.2",
|
|
54
|
+
"@vue/shared": "3.6.0-rc.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@babel/types": "^7.29.7",
|