@dcloudio/uni-cli-shared 3.0.0-5010520260709002 → 3.0.0-5020320260806002
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/dom2/vue.d.ts +0 -1
- package/dist/dom2/vue.js +1 -14
- package/dist/hbx/alias.js +16 -18
- package/dist/json/app/pages/definePage.js +3 -1
- package/dist/json/mp/index.d.ts +2 -0
- package/dist/json/mp/index.js +23 -1
- package/dist/json/mp/jsonFile.d.ts +3 -2
- package/dist/json/mp/jsonFile.js +83 -13
- package/dist/json/mp/pages.d.ts +1 -0
- package/dist/json/mp/pages.js +6 -2
- package/dist/json/mp/subpackage.d.ts +26 -0
- package/dist/json/mp/subpackage.js +236 -0
- package/dist/logs/console.js +4 -1
- 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/mp/usingComponents.d.ts +7 -5
- package/dist/mp/usingComponents.js +63 -34
- package/dist/resolve.d.ts +1 -0
- package/dist/resolve.js +9 -2
- package/dist/uts.d.ts +0 -1
- package/dist/uts.js +1 -31
- package/dist/vite/plugins/cssScoped.js +11 -2
- package/dist/vite/plugins/easycom.js +3 -1
- package/dist/vite/plugins/inject.js +7 -2
- package/dist/vite/plugins/jsonJs.js +41 -3
- package/dist/vite/plugins/sfc.js +4 -1
- package/dist/vite/plugins/vitejs/plugins/asset.js +14 -1
- package/dist/vite/plugins/vitejs/plugins/css.js +35 -1
- package/dist/vue/transforms/index.js +1 -1
- package/dist/x.d.ts +1 -0
- package/dist/x.js +5 -1
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.js +11 -9
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.prod.js +11 -9
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.d.ts +13 -1
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.esm-bundler.js +8 -7
- 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 +8 -7
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +5 -5
- 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 +8 -7
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.prod.js +5 -5
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +4772 -1513
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +3209 -1754
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +1471 -395
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.d.ts +143 -119
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +1576 -470
- 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 +77 -2
- package/lib/dom2/app/@vue/shared/dist/shared.cjs.prod.js +77 -2
- package/lib/dom2/app/@vue/shared/dist/shared.d.ts +89 -2
- package/lib/dom2/app/@vue/shared/dist/shared.esm-bundler.js +74 -3
- package/package.json +5 -5
package/dist/uts.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isUniHelpers = exports.isUTSProxy = exports.tscOutDir = exports.uvueOutDir = exports.genUniExtApiDeclarationFileOnce = exports.initUTSSwiftAutoImportsOnce = exports.initUTSKotlinAutoImportsOnce = exports.resolveUniTypeScript = exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftModuleWithPluginId = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.parseCustomElementExports = exports.initUTSCustomElements = exports.initUTSComponents = exports.parseUTSCustomElement = exports.parseUTSComponent = exports.getUTSCustomElementAutoImports = exports.getUTSComponentAutoImports = exports.getUTSCustomElement = exports.isUTSCustomElement = exports.getUTSPluginCustomElements = exports.getUTSCustomElements = exports.clearUTSCustomElements = exports.isUTSComponent = exports.clearUTSComponents = exports.getUTSCustomElementsExports = exports.resolveUTSCompilerVersion = exports.resolveUTSCompiler = exports.
|
|
6
|
+
exports.isUniHelpers = exports.isUTSProxy = exports.tscOutDir = exports.uvueOutDir = exports.genUniExtApiDeclarationFileOnce = exports.initUTSSwiftAutoImportsOnce = exports.initUTSKotlinAutoImportsOnce = exports.resolveUniTypeScript = exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftModuleWithPluginId = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.parseCustomElementExports = exports.initUTSCustomElements = exports.initUTSComponents = exports.parseUTSCustomElement = exports.parseUTSComponent = exports.getUTSCustomElementAutoImports = exports.getUTSComponentAutoImports = exports.getUTSCustomElement = exports.isUTSCustomElement = exports.getUTSPluginCustomElements = exports.getUTSCustomElements = exports.clearUTSCustomElements = exports.isUTSComponent = exports.clearUTSComponents = exports.getUTSCustomElementsExports = exports.resolveUTSCompilerVersion = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0;
|
|
7
7
|
// 重要,该文件编译后的 js 需要同步到 vue2 编译器 uni-cli-shared/lib/uts
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -165,36 +165,6 @@ function resolveUTSModule(id, importer, includeUTSSDK = true) {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
exports.resolveUTSModule = resolveUTSModule;
|
|
168
|
-
function hasUTSModulePlatformFile(pluginDir, platform) {
|
|
169
|
-
const utssdkDir = path_1.default.resolve(pluginDir, 'utssdk');
|
|
170
|
-
if (!fs_extra_1.default.existsSync(utssdkDir)) {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
// 根目录 index.uts 视为当前平台可复用,和现有 uts 解析逻辑保持一致
|
|
174
|
-
if (fs_extra_1.default.existsSync(path_1.default.resolve(utssdkDir, 'index.uts'))) {
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
if (platform === 'app-harmony') {
|
|
178
|
-
if (fs_extra_1.default.existsSync(path_1.default.resolve(utssdkDir, 'app-js', 'index.uts')) ||
|
|
179
|
-
resolveUTSFile(path_1.default.resolve(utssdkDir, platform), [
|
|
180
|
-
'.uts',
|
|
181
|
-
'.vue',
|
|
182
|
-
'.uvue',
|
|
183
|
-
])) {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
if (platform === 'app-android' || platform === 'app-ios') {
|
|
189
|
-
return !!resolveUTSFile(path_1.default.resolve(utssdkDir, platform), [
|
|
190
|
-
'.uts',
|
|
191
|
-
'.vue',
|
|
192
|
-
'.uvue',
|
|
193
|
-
]);
|
|
194
|
-
}
|
|
195
|
-
return !!resolveUTSFile(path_1.default.resolve(utssdkDir, platform));
|
|
196
|
-
}
|
|
197
|
-
exports.hasUTSModulePlatformFile = hasUTSModulePlatformFile;
|
|
198
168
|
function resolveUTSEncryptFile(pluginId, index) {
|
|
199
169
|
if (!pluginId) {
|
|
200
170
|
return;
|
|
@@ -14,8 +14,17 @@ const utils_2 = require("../../vue/utils");
|
|
|
14
14
|
const debugScoped = (0, debug_1.default)('uni:scoped');
|
|
15
15
|
const SCOPED_RE = /<style\s[^>]*scoped[^>]*>/i;
|
|
16
16
|
function addScoped(code) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const blockRanges = [];
|
|
18
|
+
code.replace(/<(script|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi, (block, _tag, offset) => {
|
|
19
|
+
blockRanges.push({
|
|
20
|
+
start: offset,
|
|
21
|
+
end: offset + block.length,
|
|
22
|
+
});
|
|
23
|
+
return block;
|
|
24
|
+
});
|
|
25
|
+
return code.replace(/(<style\b[^><]*)>/gi, (str, $1, offset) => {
|
|
26
|
+
if ($1.includes('scoped') ||
|
|
27
|
+
blockRanges.some((range) => offset > range.start && offset < range.end)) {
|
|
19
28
|
return str;
|
|
20
29
|
}
|
|
21
30
|
return `${$1} scoped>`;
|
|
@@ -48,7 +48,9 @@ function uniEasycomPlugin(options) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
if (process.env.UNI_APP_X === 'true') {
|
|
51
|
-
if (
|
|
51
|
+
if (process.env.UNI_APP_X_DOM2 === 'true'
|
|
52
|
+
? (0, uni_shared_1.isDom2AppVueComponentTag)(name)
|
|
53
|
+
: (0, uni_shared_1.isAppUVueBuiltInEasyComponent)(name)) {
|
|
52
54
|
// 内置easycom组件不传入self参数
|
|
53
55
|
return str.replace(', true)', ')');
|
|
54
56
|
}
|
|
@@ -12,6 +12,7 @@ const shared_1 = require("@vue/shared");
|
|
|
12
12
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
13
13
|
const utils_1 = require("../utils");
|
|
14
14
|
const uts_1 = require("../../uts");
|
|
15
|
+
const x_1 = require("../../x");
|
|
15
16
|
const debugInject = (0, debug_1.default)('uni:inject');
|
|
16
17
|
// const debugInjectTry = debug('uni:inject-try')
|
|
17
18
|
function uniViteInjectPlugin(name, options) {
|
|
@@ -131,7 +132,7 @@ function uniViteInjectPlugin(name, options) {
|
|
|
131
132
|
}
|
|
132
133
|
(0, estree_walker_1.walk)(ast, {
|
|
133
134
|
enter(node, parent) {
|
|
134
|
-
if (sourceMap) {
|
|
135
|
+
if (sourceMap && (0, x_1.shouldUseHighResolutionSourceMap)()) {
|
|
135
136
|
magicString.addSourcemapLocation(node.start);
|
|
136
137
|
magicString.addSourcemapLocation(node.end);
|
|
137
138
|
}
|
|
@@ -173,7 +174,11 @@ function uniViteInjectPlugin(name, options) {
|
|
|
173
174
|
magicString.prepend(`${importBlock}\n\n`);
|
|
174
175
|
return {
|
|
175
176
|
code: magicString.toString(),
|
|
176
|
-
map: sourceMap
|
|
177
|
+
map: sourceMap
|
|
178
|
+
? magicString.generateMap({
|
|
179
|
+
hires: (0, x_1.shouldUseHighResolutionSourceMap)(),
|
|
180
|
+
})
|
|
181
|
+
: null,
|
|
177
182
|
};
|
|
178
183
|
},
|
|
179
184
|
};
|
|
@@ -7,16 +7,19 @@ exports.defineUniManifestJsonPlugin = exports.defineUniPagesJsonPlugin = void 0;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const constants_1 = require("../../constants");
|
|
10
|
+
const subpackage_1 = require("../../json/mp/subpackage");
|
|
10
11
|
const utils_1 = require("../../utils");
|
|
11
12
|
exports.defineUniPagesJsonPlugin = createDefineJsonJsPlugin('pages.json');
|
|
12
13
|
exports.defineUniManifestJsonPlugin = createDefineJsonJsPlugin('manifest.json');
|
|
13
14
|
function createDefineJsonJsPlugin(name) {
|
|
14
15
|
const JSON_JS = constants_1.JSON_JS_MAP[name];
|
|
16
|
+
// pages-json-js 仅允许独立分包 root query;manifest-json-js 仍保持 app 级。
|
|
17
|
+
const allowedQuery = name === 'pages.json' ? subpackage_1.MP_INDEPENDENT_ROOT_QUERY : '';
|
|
15
18
|
return function (createVitePlugin) {
|
|
16
19
|
const opts = {
|
|
17
20
|
resolvedConfig: {},
|
|
18
21
|
filter(id) {
|
|
19
|
-
return id
|
|
22
|
+
return !!parseJsonJsRequest(id, JSON_JS, allowedQuery);
|
|
20
23
|
},
|
|
21
24
|
};
|
|
22
25
|
const plugin = createVitePlugin(opts);
|
|
@@ -30,8 +33,9 @@ function createDefineJsonJsPlugin(name) {
|
|
|
30
33
|
if (res) {
|
|
31
34
|
return res;
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
const jsonJsRequest = parseJsonJsRequest(id, JSON_JS, allowedQuery);
|
|
37
|
+
if (jsonJsRequest) {
|
|
38
|
+
return jsonJsPath + jsonJsRequest.query;
|
|
35
39
|
}
|
|
36
40
|
};
|
|
37
41
|
plugin.configResolved = function (config) {
|
|
@@ -53,3 +57,37 @@ function createDefineJsonJsPlugin(name) {
|
|
|
53
57
|
return plugin;
|
|
54
58
|
};
|
|
55
59
|
}
|
|
60
|
+
function parseJsonJsRequest(id, jsonJs, allowedQuery) {
|
|
61
|
+
const queryIndex = id.indexOf('?');
|
|
62
|
+
const query = queryIndex === -1 ? '' : id.slice(queryIndex + 1);
|
|
63
|
+
if (query && !isAllowedJsonJsQuery(query, allowedQuery)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (queryIndex !== -1 && !query) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const filename = queryIndex === -1 ? id : id.slice(0, queryIndex);
|
|
70
|
+
if (!filename.endsWith(jsonJs)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
filename,
|
|
75
|
+
query: queryIndex === -1 ? '' : id.slice(queryIndex),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function isAllowedJsonJsQuery(query, allowedQuery) {
|
|
79
|
+
if (!allowedQuery) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
const items = query.split('&');
|
|
83
|
+
if (items.length !== 1) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
const item = items[0];
|
|
87
|
+
const equalIndex = item.indexOf('=');
|
|
88
|
+
if (equalIndex === -1) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
return (item.slice(0, equalIndex) === allowedQuery &&
|
|
92
|
+
item.slice(equalIndex + 1).length > 0);
|
|
93
|
+
}
|
package/dist/vite/plugins/sfc.js
CHANGED
|
@@ -9,6 +9,7 @@ const magic_string_1 = __importDefault(require("magic-string"));
|
|
|
9
9
|
const vue_1 = require("../../vue");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
const preprocess_1 = require("../../preprocess");
|
|
12
|
+
const x_1 = require("../../x");
|
|
12
13
|
const SRC_IMPORT_RE = /<(template|script|style)[^>]*src\s*=\s*["']([^"']+)["'][^>]*>/;
|
|
13
14
|
const SRC_IMPORT_VUE_RE = /<(template|script|style)[^>]*src\s*=\s*["'](.*\.uvue|.*\.vue)["'][^>]*>/;
|
|
14
15
|
function isSrcImport(code) {
|
|
@@ -120,7 +121,9 @@ function uniViteSfcSrcImportPlugin({ onlyVue } = { onlyVue: true }) {
|
|
|
120
121
|
}
|
|
121
122
|
return {
|
|
122
123
|
code: s.toString(),
|
|
123
|
-
map: sourceMap
|
|
124
|
+
map: sourceMap
|
|
125
|
+
? s.generateMap({ hires: (0, x_1.shouldUseHighResolutionSourceMap)() })
|
|
126
|
+
: null,
|
|
124
127
|
};
|
|
125
128
|
},
|
|
126
129
|
};
|
|
@@ -37,8 +37,10 @@ const shared_1 = require("@vue/shared");
|
|
|
37
37
|
const utils_1 = require("../utils");
|
|
38
38
|
const utils_2 = require("../../../../vite/utils/utils");
|
|
39
39
|
const utils_3 = require("../../../../utils");
|
|
40
|
+
const x_1 = require("../../../../x");
|
|
40
41
|
const static_1 = require("./static");
|
|
41
42
|
exports.assetUrlRE = /__VITE_ASSET__([a-z\d]{8})__(?:\$_(.*?)__)?/g;
|
|
43
|
+
const assetUrlMarker = '__VITE_ASSET__';
|
|
42
44
|
const rawRE = /(\?|&)raw(?:&|$)/;
|
|
43
45
|
const urlRE = /(\?|&)url(?:&|$)/;
|
|
44
46
|
exports.chunkToEmittedAssetsMap = new WeakMap();
|
|
@@ -106,6 +108,10 @@ function assetPlugin(config, options) {
|
|
|
106
108
|
let match;
|
|
107
109
|
let s;
|
|
108
110
|
exports.assetUrlRE.lastIndex = 0;
|
|
111
|
+
// 部分 chunk 不包含资源占位符,先用低成本字符串查找跳过正则扫描。
|
|
112
|
+
if (code.indexOf(assetUrlMarker) === -1) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
109
115
|
// Urls added with JS using e.g.
|
|
110
116
|
// imgElement.src = "__VITE_ASSET__5aa0ddc0__" are using quotes
|
|
111
117
|
// Urls added in CSS that is imported in JS end up like
|
|
@@ -124,7 +130,9 @@ function assetPlugin(config, options) {
|
|
|
124
130
|
if (s) {
|
|
125
131
|
return {
|
|
126
132
|
code: s.toString(),
|
|
127
|
-
map: (0, utils_2.withSourcemap)(config)
|
|
133
|
+
map: (0, utils_2.withSourcemap)(config)
|
|
134
|
+
? s.generateMap({ hires: shouldUseAssetHighResolutionSourceMap() })
|
|
135
|
+
: null,
|
|
128
136
|
};
|
|
129
137
|
}
|
|
130
138
|
else {
|
|
@@ -134,6 +142,11 @@ function assetPlugin(config, options) {
|
|
|
134
142
|
};
|
|
135
143
|
}
|
|
136
144
|
exports.assetPlugin = assetPlugin;
|
|
145
|
+
function shouldUseAssetHighResolutionSourceMap() {
|
|
146
|
+
// Android dom2 的 app-service 后续会与 esbuild map 合并,低精度 asset map
|
|
147
|
+
// 可能导致原始 .uvue 映射丢失或断点偏移。
|
|
148
|
+
return (0, x_1.isUniAppXAndroid)() || (0, x_1.shouldUseHighResolutionSourceMap)();
|
|
149
|
+
}
|
|
137
150
|
function parseAssets(config, code) {
|
|
138
151
|
let match;
|
|
139
152
|
let s;
|
|
@@ -42,6 +42,7 @@ const shared_1 = require("@vue/shared");
|
|
|
42
42
|
const preprocess_1 = require("../../../../preprocess");
|
|
43
43
|
const uniapp_1 = require("../../../../postcss/plugins/uniapp");
|
|
44
44
|
const cleanString_1 = require("../cleanString");
|
|
45
|
+
const x_1 = require("../../../../x");
|
|
45
46
|
const constants_1 = require("../../../../constants");
|
|
46
47
|
const fontFamily_1 = require("../../../../dom2/fontFamily");
|
|
47
48
|
const utils_2 = require("../../../utils/utils");
|
|
@@ -223,9 +224,17 @@ function findCssModuleIds(moduleId, includeComponentCss = true, cssModuleIds, se
|
|
|
223
224
|
function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFilename, chunkCssCode, includeComponentCss, emitFile, }) {
|
|
224
225
|
// styles initialization in buildStart causes a styling loss in watch
|
|
225
226
|
const styles = new Map();
|
|
227
|
+
// 只缓存 cssCode 的 hash,不缓存完整 css,避免用空间换时间。
|
|
228
|
+
const cssChunkCodeHashCache = new Map();
|
|
226
229
|
let cssChunks;
|
|
227
230
|
const isDom2 = process.env.UNI_APP_X_DOM2 === 'true';
|
|
228
231
|
const isDom2App = isDom2 && platform.startsWith('app');
|
|
232
|
+
// 仅限定鸿蒙 DOM2 开发模式,避免影响其它平台和生产构建。
|
|
233
|
+
const enableCssIncremental = process.env.NODE_ENV === 'development' &&
|
|
234
|
+
process.env.UNI_UTS_PLATFORM === 'app-harmony' &&
|
|
235
|
+
isDom2App &&
|
|
236
|
+
!!isJsCode &&
|
|
237
|
+
!!emitFile;
|
|
229
238
|
return {
|
|
230
239
|
name: 'vite:css-post',
|
|
231
240
|
buildStart() {
|
|
@@ -339,6 +348,9 @@ function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFi
|
|
|
339
348
|
});
|
|
340
349
|
}
|
|
341
350
|
if (!cssChunks.size) {
|
|
351
|
+
if (enableCssIncremental) {
|
|
352
|
+
cssChunkCodeHashCache.clear();
|
|
353
|
+
}
|
|
342
354
|
return;
|
|
343
355
|
}
|
|
344
356
|
// resolve asset URL placeholders to their built file URLs and perform
|
|
@@ -367,8 +379,20 @@ function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFi
|
|
|
367
379
|
.map((id) => styles.get(id) || '')
|
|
368
380
|
.join('\n');
|
|
369
381
|
};
|
|
382
|
+
const currentCssFilenames = enableCssIncremental
|
|
383
|
+
? new Set(cssChunks.keys())
|
|
384
|
+
: undefined;
|
|
370
385
|
for (const filename of cssChunks.keys()) {
|
|
371
386
|
const cssCode = genCssCode(filename);
|
|
387
|
+
const cssCodeHash = enableCssIncremental ? (0, utils_3.hash)(cssCode) : '';
|
|
388
|
+
const hasFontFace = enableCssIncremental && /@font-face\b/i.test(cssCode);
|
|
389
|
+
// 鸿蒙 DOM2 开发模式下,未变化的样式无需重复 parseCss 和写入原生侧。
|
|
390
|
+
// @font-face 会在 chunkCssCode 中写入字体缓存,必须保留原有副作用。
|
|
391
|
+
if (enableCssIncremental &&
|
|
392
|
+
!hasFontFace &&
|
|
393
|
+
cssChunkCodeHashCache.get(filename) === cssCodeHash) {
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
372
396
|
let source = await processChunkCSS(cssCode, {
|
|
373
397
|
filename: filename,
|
|
374
398
|
inlined: false,
|
|
@@ -386,6 +410,16 @@ function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFi
|
|
|
386
410
|
source,
|
|
387
411
|
});
|
|
388
412
|
}
|
|
413
|
+
if (enableCssIncremental) {
|
|
414
|
+
cssChunkCodeHashCache.set(filename, cssCodeHash);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (currentCssFilenames) {
|
|
418
|
+
cssChunkCodeHashCache.forEach((_, filename) => {
|
|
419
|
+
if (!currentCssFilenames.has(filename)) {
|
|
420
|
+
cssChunkCodeHashCache.delete(filename);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
389
423
|
}
|
|
390
424
|
},
|
|
391
425
|
};
|
|
@@ -1175,7 +1209,7 @@ async function getSource(source, filename, additionalData, enableSourcemap, sep
|
|
|
1175
1209
|
const ms = new magic_string_1.default(source);
|
|
1176
1210
|
ms.appendLeft(0, sep);
|
|
1177
1211
|
ms.appendLeft(0, additionalData);
|
|
1178
|
-
const map = ms.generateMap({ hires:
|
|
1212
|
+
const map = ms.generateMap({ hires: (0, x_1.shouldUseHighResolutionSourceMap)() });
|
|
1179
1213
|
map.file = filename;
|
|
1180
1214
|
map.sources = [filename];
|
|
1181
1215
|
return {
|
|
@@ -40,7 +40,7 @@ Object.defineProperty(exports, "matchTransformOn", { enumerable: true, get: func
|
|
|
40
40
|
var vModel_1 = require("./vModel");
|
|
41
41
|
Object.defineProperty(exports, "createTransformModel", { enumerable: true, get: function () { return vModel_1.createTransformModel; } });
|
|
42
42
|
Object.defineProperty(exports, "matchTransformModel", { enumerable: true, get: function () { return vModel_1.defaultMatch; } });
|
|
43
|
-
exports.transformH5BuiltInComponents = (0, transformTag_1.createTransformTag)(uni_shared_1.
|
|
43
|
+
exports.transformH5BuiltInComponents = (0, transformTag_1.createTransformTag)(uni_shared_1.H5_BUILT_IN_TAG_NAMES.reduce((tags, tag) => ((tags[tag] = uni_shared_1.COMPONENT_PREFIX + tag), tags), {}));
|
|
44
44
|
exports.transformMatchMedia = (0, transformTag_1.createTransformTag)({
|
|
45
45
|
'match-media': 'uni-match-media',
|
|
46
46
|
});
|
package/dist/x.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare function isUniAppX(): boolean;
|
|
|
3
3
|
export declare function isUniAppXAndroid(platform?: AppXPlatform): boolean;
|
|
4
4
|
export declare function isUniAppXIOS(platform?: AppXPlatform): boolean;
|
|
5
5
|
export declare function isUniAppXVapor(): boolean;
|
|
6
|
+
export declare function shouldUseHighResolutionSourceMap(): boolean;
|
|
6
7
|
export declare function isUniAppXAndroidVapor(platform?: AppXPlatform): boolean;
|
|
7
8
|
export declare function isUniAppXJsEngine(): boolean;
|
|
8
9
|
export declare function isUniAppXAndroidJsEngine(platform?: AppXPlatform): boolean;
|
package/dist/x.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUniAppXAndroidNative = exports.isUniAppXAndroidJsEngine = exports.isUniAppXJsEngine = exports.isUniAppXAndroidVapor = exports.isUniAppXVapor = exports.isUniAppXIOS = exports.isUniAppXAndroid = exports.isUniAppX = void 0;
|
|
3
|
+
exports.isUniAppXAndroidNative = exports.isUniAppXAndroidJsEngine = exports.isUniAppXJsEngine = exports.isUniAppXAndroidVapor = exports.shouldUseHighResolutionSourceMap = exports.isUniAppXVapor = exports.isUniAppXIOS = exports.isUniAppXAndroid = exports.isUniAppX = void 0;
|
|
4
4
|
function isUniAppX() {
|
|
5
5
|
return process.env.UNI_APP_X === 'true';
|
|
6
6
|
}
|
|
@@ -17,6 +17,10 @@ function isUniAppXVapor() {
|
|
|
17
17
|
return isUniAppX() && process.env.UNI_APP_X_DOM2 === 'true';
|
|
18
18
|
}
|
|
19
19
|
exports.isUniAppXVapor = isUniAppXVapor;
|
|
20
|
+
function shouldUseHighResolutionSourceMap() {
|
|
21
|
+
return !(process.env.NODE_ENV === 'development' && isUniAppXVapor());
|
|
22
|
+
}
|
|
23
|
+
exports.shouldUseHighResolutionSourceMap = shouldUseHighResolutionSourceMap;
|
|
20
24
|
function isUniAppXAndroidVapor(platform = process.env.UNI_UTS_PLATFORM) {
|
|
21
25
|
return isUniAppXAndroid(platform) && process.env.UNI_APP_X_DOM2 === 'true';
|
|
22
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-core v3.6.0-beta.17
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2633,7 +2633,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2633
2633
|
}
|
|
2634
2634
|
},
|
|
2635
2635
|
oncdata(start, end) {
|
|
2636
|
-
if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
|
|
2636
|
+
if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
|
|
2637
2637
|
else emitError(1, start - 9);
|
|
2638
2638
|
},
|
|
2639
2639
|
onprocessinginstruction(start) {
|
|
@@ -3147,7 +3147,7 @@ function getSelfName(filename) {
|
|
|
3147
3147
|
}
|
|
3148
3148
|
function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = _vue_shared.NOOP, isCustomElement = _vue_shared.NOOP, isUserComponent = (element) => {
|
|
3149
3149
|
return element.tagType === 1;
|
|
3150
|
-
}, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = _vue_shared.EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
|
|
3150
|
+
}, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = _vue_shared.EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
|
|
3151
3151
|
const context = {
|
|
3152
3152
|
filename,
|
|
3153
3153
|
selfName: getSelfName(filename),
|
|
@@ -3170,6 +3170,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
3170
3170
|
bindingMetadata,
|
|
3171
3171
|
inline,
|
|
3172
3172
|
isTS,
|
|
3173
|
+
eventDelegation,
|
|
3173
3174
|
onError,
|
|
3174
3175
|
onWarn,
|
|
3175
3176
|
compatConfig,
|
|
@@ -3181,6 +3182,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
3181
3182
|
imports: [],
|
|
3182
3183
|
cached: [],
|
|
3183
3184
|
constantCache: /* @__PURE__ */ new WeakMap(),
|
|
3185
|
+
vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
|
|
3184
3186
|
temps: 0,
|
|
3185
3187
|
identifiers: Object.create(null),
|
|
3186
3188
|
identifierScopes: Object.create(null),
|
|
@@ -3961,7 +3963,7 @@ const transformExpression = (node, context) => {
|
|
|
3961
3963
|
if (dir.type === 7 && dir.name !== "for") {
|
|
3962
3964
|
const exp = dir.exp;
|
|
3963
3965
|
const arg = dir.arg;
|
|
3964
|
-
if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
|
|
3966
|
+
if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
|
|
3965
3967
|
if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
|
|
3966
3968
|
}
|
|
3967
3969
|
}
|
|
@@ -4219,11 +4221,11 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
|
|
|
4219
4221
|
const keyProp = findProp(node, `key`, false, true);
|
|
4220
4222
|
const isDirKey = keyProp && keyProp.type === 7;
|
|
4221
4223
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
if (isTemplate) {
|
|
4225
|
-
|
|
4226
|
-
if (
|
|
4224
|
+
const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
4225
|
+
if (isTemplate && memo) memo.exp = processExpression(memo.exp, context);
|
|
4226
|
+
if ((isTemplate || memo) && keyProperty && isDirKey) {
|
|
4227
|
+
keyExp = keyProp.exp = keyProperty.value = processExpression(keyProperty.value, context);
|
|
4228
|
+
if (memo) context.vForMemoKeyedNodes.add(node);
|
|
4227
4229
|
}
|
|
4228
4230
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
4229
4231
|
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-core v3.6.0-beta.17
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2629,7 +2629,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2629
2629
|
}
|
|
2630
2630
|
},
|
|
2631
2631
|
oncdata(start, end) {
|
|
2632
|
-
if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
|
|
2632
|
+
if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
|
|
2633
2633
|
else emitError(1, start - 9);
|
|
2634
2634
|
},
|
|
2635
2635
|
onprocessinginstruction(start) {
|
|
@@ -3126,7 +3126,7 @@ function getSelfName(filename) {
|
|
|
3126
3126
|
}
|
|
3127
3127
|
function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = _vue_shared.NOOP, isCustomElement = _vue_shared.NOOP, isUserComponent = (element) => {
|
|
3128
3128
|
return element.tagType === 1;
|
|
3129
|
-
}, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = _vue_shared.EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
|
|
3129
|
+
}, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = _vue_shared.EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
|
|
3130
3130
|
const context = {
|
|
3131
3131
|
filename,
|
|
3132
3132
|
selfName: getSelfName(filename),
|
|
@@ -3149,6 +3149,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
3149
3149
|
bindingMetadata,
|
|
3150
3150
|
inline,
|
|
3151
3151
|
isTS,
|
|
3152
|
+
eventDelegation,
|
|
3152
3153
|
onError,
|
|
3153
3154
|
onWarn,
|
|
3154
3155
|
compatConfig,
|
|
@@ -3160,6 +3161,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
3160
3161
|
imports: [],
|
|
3161
3162
|
cached: [],
|
|
3162
3163
|
constantCache: /* @__PURE__ */ new WeakMap(),
|
|
3164
|
+
vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
|
|
3163
3165
|
temps: 0,
|
|
3164
3166
|
identifiers: Object.create(null),
|
|
3165
3167
|
identifierScopes: Object.create(null),
|
|
@@ -3926,7 +3928,7 @@ const transformExpression = (node, context) => {
|
|
|
3926
3928
|
if (dir.type === 7 && dir.name !== "for") {
|
|
3927
3929
|
const exp = dir.exp;
|
|
3928
3930
|
const arg = dir.arg;
|
|
3929
|
-
if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
|
|
3931
|
+
if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
|
|
3930
3932
|
if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
|
|
3931
3933
|
}
|
|
3932
3934
|
}
|
|
@@ -4177,11 +4179,11 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
|
|
|
4177
4179
|
const keyProp = findProp(node, `key`, false, true);
|
|
4178
4180
|
const isDirKey = keyProp && keyProp.type === 7;
|
|
4179
4181
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
if (isTemplate) {
|
|
4183
|
-
|
|
4184
|
-
if (
|
|
4182
|
+
const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
4183
|
+
if (isTemplate && memo) memo.exp = processExpression(memo.exp, context);
|
|
4184
|
+
if ((isTemplate || memo) && keyProperty && isDirKey) {
|
|
4185
|
+
keyExp = keyProp.exp = keyProperty.value = processExpression(keyProperty.value, context);
|
|
4186
|
+
if (memo) context.vForMemoKeyedNodes.add(node);
|
|
4185
4187
|
}
|
|
4186
4188
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
4187
4189
|
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
|
|
@@ -137,6 +137,7 @@ export interface TransformContext extends Required<Omit<TransformOptions, keyof
|
|
|
137
137
|
hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode;
|
|
138
138
|
cache(exp: JSChildNode, isVNode?: boolean, inVOnce?: boolean): CacheExpression;
|
|
139
139
|
constantCache: WeakMap<TemplateChildNode, ConstantTypes>;
|
|
140
|
+
vForMemoKeyedNodes: WeakSet<ElementNode>;
|
|
140
141
|
filters?: Set<string>;
|
|
141
142
|
}
|
|
142
143
|
export declare function getSelfName(filename: string): string | null;
|
|
@@ -161,6 +162,7 @@ export declare function createTransformContext(root: RootNode, {
|
|
|
161
162
|
bindingMetadata,
|
|
162
163
|
inline,
|
|
163
164
|
isTS,
|
|
165
|
+
eventDelegation,
|
|
164
166
|
onError,
|
|
165
167
|
onWarn,
|
|
166
168
|
compatConfig
|
|
@@ -262,6 +264,10 @@ export interface BaseElementNode extends Node {
|
|
|
262
264
|
children: TemplateChildNode[];
|
|
263
265
|
isSelfClosing?: boolean;
|
|
264
266
|
innerLoc?: SourceLocation;
|
|
267
|
+
/**
|
|
268
|
+
* fixed by uts DOM2 编译期 flatten 静态值。
|
|
269
|
+
*/
|
|
270
|
+
flatten?: boolean;
|
|
265
271
|
}
|
|
266
272
|
export interface PlainElementNode extends BaseElementNode {
|
|
267
273
|
tagType: ElementTypes.ELEMENT;
|
|
@@ -951,6 +957,12 @@ export interface TransformOptions extends SharedTransformCodegenOptions, ErrorHa
|
|
|
951
957
|
* correctly, e.g. #6938, #7138
|
|
952
958
|
*/
|
|
953
959
|
hmr?: boolean;
|
|
960
|
+
/**
|
|
961
|
+
* Vapor only: control whether eligible static DOM events are compiled to
|
|
962
|
+
* document-level delegated events.
|
|
963
|
+
* @default true
|
|
964
|
+
*/
|
|
965
|
+
eventDelegation?: boolean;
|
|
954
966
|
}
|
|
955
967
|
export interface CodegenOptions extends SharedTransformCodegenOptions {
|
|
956
968
|
/**
|
|
@@ -1005,7 +1017,7 @@ export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions;
|
|
|
1005
1017
|
*
|
|
1006
1018
|
* Since TS 5.3, dts generation starts to strangely include broken triple slash
|
|
1007
1019
|
* references for source-map-js, so we are inlining all source map related types
|
|
1008
|
-
* here to
|
|
1020
|
+
* here to workaround that.
|
|
1009
1021
|
*/
|
|
1010
1022
|
export interface CodegenSourceMapGenerator {
|
|
1011
1023
|
setSourceContent(sourceFile: string, sourceContent: string): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-core v3.6.0-beta.17
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1980,7 +1980,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
1980
1980
|
}
|
|
1981
1981
|
},
|
|
1982
1982
|
oncdata(start, end) {
|
|
1983
|
-
if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
|
|
1983
|
+
if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
|
|
1984
1984
|
else emitError(1, start - 9);
|
|
1985
1985
|
},
|
|
1986
1986
|
onprocessinginstruction(start) {
|
|
@@ -2485,7 +2485,7 @@ function getSelfName(filename) {
|
|
|
2485
2485
|
}
|
|
2486
2486
|
function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, isUserComponent = (element) => {
|
|
2487
2487
|
return element.tagType === 1;
|
|
2488
|
-
}, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
|
|
2488
|
+
}, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
|
|
2489
2489
|
const context = {
|
|
2490
2490
|
filename,
|
|
2491
2491
|
selfName: getSelfName(filename),
|
|
@@ -2508,6 +2508,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
2508
2508
|
bindingMetadata,
|
|
2509
2509
|
inline,
|
|
2510
2510
|
isTS,
|
|
2511
|
+
eventDelegation,
|
|
2511
2512
|
onError,
|
|
2512
2513
|
onWarn,
|
|
2513
2514
|
compatConfig,
|
|
@@ -2519,6 +2520,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
|
|
|
2519
2520
|
imports: [],
|
|
2520
2521
|
cached: [],
|
|
2521
2522
|
constantCache: /* @__PURE__ */ new WeakMap(),
|
|
2523
|
+
vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
|
|
2522
2524
|
temps: 0,
|
|
2523
2525
|
identifiers: Object.create(null),
|
|
2524
2526
|
identifierScopes: Object.create(null),
|
|
@@ -3165,7 +3167,7 @@ const transformExpression = (node, context) => {
|
|
|
3165
3167
|
if (dir.type === 7 && dir.name !== "for") {
|
|
3166
3168
|
const exp = dir.exp;
|
|
3167
3169
|
const arg = dir.arg;
|
|
3168
|
-
if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
|
|
3170
|
+
if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
|
|
3169
3171
|
if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
|
|
3170
3172
|
}
|
|
3171
3173
|
}
|
|
@@ -3311,10 +3313,9 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
|
|
|
3311
3313
|
const isTemplate = isTemplateNode(node);
|
|
3312
3314
|
const memo = findDir(node, "memo");
|
|
3313
3315
|
const keyProp = findProp(node, `key`, false, true);
|
|
3314
|
-
|
|
3316
|
+
keyProp && keyProp.type;
|
|
3315
3317
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
3316
|
-
|
|
3317
|
-
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
3318
|
+
const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
3318
3319
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
3319
3320
|
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
|
|
3320
3321
|
forNode.codegenNode = createVNodeCall(context, helper(FRAGMENT), void 0, renderExp, fragmentFlag, void 0, void 0, true, !isStableFragment, false, node.loc);
|