@dcloudio/uni-cli-shared 3.0.0-alpha-5010420260626001 → 3.0.0-alpha-1000920260626810
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/index.d.ts +0 -1
- package/dist/dom2/index.js +0 -1
- package/dist/hbx/alias.js +21 -2
- package/dist/hbx/index.d.ts +1 -1
- package/dist/i18n.js +32 -17
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/json/app/manifest/plus.js +1 -9
- package/dist/json/app/pages/definePage.js +1 -1
- package/dist/logs/console.js +15 -1
- package/dist/messages/en.d.ts +2 -4
- package/dist/messages/en.js +2 -4
- package/dist/messages/index.d.ts +4 -8
- package/dist/messages/zh_CN.d.ts +2 -4
- package/dist/messages/zh_CN.js +2 -4
- package/dist/mp/imports.d.ts +3 -1
- package/dist/mp/template.d.ts +2 -1
- package/dist/mp/usingComponents.d.ts +2 -1
- package/dist/postcss/plugins/stylePluginExternal.d.ts +10 -9
- package/dist/postcss/plugins/stylePluginExternal.js +45 -51
- package/dist/uni_modules.cloud.d.ts +0 -5
- package/dist/uni_modules.cloud.js +1 -102
- package/dist/vite/cloud.js +2 -5
- package/dist/vite/index.d.ts +2 -3
- package/dist/vite/plugins/console.js +31 -27
- package/dist/vite/plugins/copy.js +1 -0
- package/dist/vite/plugins/cssScoped.js +25 -16
- package/dist/vite/plugins/dynamicImportPolyfill.d.ts +8 -1
- package/dist/vite/plugins/easycom.js +46 -43
- package/dist/vite/plugins/inject.js +132 -113
- package/dist/vite/plugins/json.js +17 -14
- package/dist/vite/plugins/jsonJs.d.ts +2 -2
- package/dist/vite/plugins/jsonJs.js +7 -0
- package/dist/vite/plugins/mainJs.d.ts +1 -1
- package/dist/vite/plugins/mainJs.js +7 -0
- package/dist/vite/plugins/pre.js +35 -32
- package/dist/vite/plugins/sfc.js +15 -2
- package/dist/vite/plugins/sourceMap.js +4 -1
- package/dist/vite/plugins/stats.d.ts +1 -5
- package/dist/vite/plugins/stats.js +2 -71
- package/dist/vite/plugins/uts/ext-api.js +23 -17
- package/dist/vite/plugins/uts/uni_modules.js +66 -44
- package/dist/vite/plugins/uts/uvue.js +55 -48
- package/dist/vite/plugins/vitejs/plugins/asset.d.ts +12 -4
- package/dist/vite/plugins/vitejs/plugins/asset.js +7 -2
- package/dist/vite/plugins/vitejs/plugins/css.d.ts +4 -1
- package/dist/vite/plugins/vitejs/plugins/css.js +102 -82
- package/dist/vite/utils/utils.d.ts +3 -2
- package/dist/vue/transforms/index.d.ts +0 -1
- package/dist/vue/transforms/index.js +0 -1
- package/dist/vue/transforms/x/transformDirection.js +4 -33
- package/dist/watcher.d.ts +1 -0
- package/dist/x.d.ts +1 -0
- package/dist/x.js +5 -1
- package/lib/@vue/compiler-core/dist/compiler-core.cjs.js +16 -23
- package/lib/@vue/compiler-core/dist/compiler-core.cjs.prod.js +16 -23
- package/lib/@vue/compiler-core/dist/compiler-core.esm-bundler.js +16 -23
- package/lib/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +23 -66
- package/lib/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +67 -115
- 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.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 +3 -3
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +45 -217
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +43 -218
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.d.ts +12 -62
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +44 -228
- 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 +8 -9
- package/dist/dom2/rootScrollView.d.ts +0 -47
- package/dist/dom2/rootScrollView.js +0 -283
- package/dist/vue/transforms/transformTeleport.d.ts +0 -2
- package/dist/vue/transforms/transformTeleport.js +0 -63
package/dist/dom2/index.d.ts
CHANGED
package/dist/dom2/index.js
CHANGED
package/dist/hbx/alias.js
CHANGED
|
@@ -78,8 +78,27 @@ function initModuleAlias() {
|
|
|
78
78
|
if (process.env.UNI_APP_PLATFORM ||
|
|
79
79
|
process.env.UNI_PLATFORM === 'app-harmony') {
|
|
80
80
|
if (!process.env.UNI_APP_X_VAPOR_RENDER_TARGET) {
|
|
81
|
-
//
|
|
82
|
-
process.env.
|
|
81
|
+
// ios 和 harmony 平台默认使用 bytecode 目标,存在 .native 文件时使用 native 目标;其他平台如果存在 .dynamic 文件则使用 bytecode 目标,否则使用 native 目标
|
|
82
|
+
if (process.env.UNI_APP_PLATFORM === 'ios' ||
|
|
83
|
+
process.env.UNI_APP_PLATFORM === 'harmony' ||
|
|
84
|
+
process.env.UNI_PLATFORM === 'app-harmony') {
|
|
85
|
+
if (process.env.UNI_INPUT_DIR &&
|
|
86
|
+
fs_1.default.existsSync(path_1.default.resolve(process.env.UNI_INPUT_DIR, '.native'))) {
|
|
87
|
+
process.env.UNI_APP_X_VAPOR_RENDER_TARGET = 'nativecode';
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
process.env.UNI_APP_X_VAPOR_RENDER_TARGET = 'bytecode';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
if (process.env.UNI_INPUT_DIR &&
|
|
95
|
+
fs_1.default.existsSync(path_1.default.resolve(process.env.UNI_INPUT_DIR, '.dynamic'))) {
|
|
96
|
+
process.env.UNI_APP_X_VAPOR_RENDER_TARGET = 'bytecode';
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
process.env.UNI_APP_X_VAPOR_RENDER_TARGET = 'nativecode';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
83
102
|
}
|
|
84
103
|
if (process.env.UNI_APP_X_VAPOR_RENDER_TARGET?.includes('bytecode')) {
|
|
85
104
|
process.env.UNI_APP_X_DOM2_DYNAMIC = 'true';
|
package/dist/hbx/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { formatAtFilename, createErrorWithBlockFlag } from './log';
|
|
2
2
|
export * from './env';
|
|
3
3
|
export { initModuleAlias, installHBuilderXPlugin, formatInstallHBuilderXPluginTips, } from './alias';
|
|
4
|
-
export declare function uniHBuilderXConsolePlugin(method?: string): import("vite").Plugin<any>;
|
|
4
|
+
export declare function uniHBuilderXConsolePlugin(method?: string): import("vite/dist/node").Plugin<any>;
|
|
5
5
|
export declare function isEnableConsole(): boolean;
|
package/dist/i18n.js
CHANGED
|
@@ -47,36 +47,51 @@ function isUniAppLocaleFile(filepath) {
|
|
|
47
47
|
return localeJsonRE.test(path_1.default.basename(filepath));
|
|
48
48
|
}
|
|
49
49
|
exports.isUniAppLocaleFile = isUniAppLocaleFile;
|
|
50
|
+
const localeJsonCache = new Map();
|
|
50
51
|
function parseLocaleJson(filepath) {
|
|
52
|
+
const { mtimeMs, size } = fs_1.default.statSync(filepath);
|
|
53
|
+
const cached = localeJsonCache.get(filepath);
|
|
54
|
+
if (cached && cached.mtimeMs === mtimeMs && cached.size === size) {
|
|
55
|
+
return cached.json;
|
|
56
|
+
}
|
|
51
57
|
let jsonObj = (0, json_1.parseJson)(fs_1.default.readFileSync(filepath, 'utf8'), false, filepath);
|
|
52
58
|
if (isUniAppLocaleFile(filepath)) {
|
|
53
59
|
jsonObj = jsonObj.common || {};
|
|
54
60
|
}
|
|
61
|
+
localeJsonCache.set(filepath, { mtimeMs, size, json: jsonObj });
|
|
55
62
|
return jsonObj;
|
|
56
63
|
}
|
|
64
|
+
const localeFilesCache = new Map();
|
|
57
65
|
function getLocaleFiles(cwd) {
|
|
58
|
-
|
|
66
|
+
let mtimeMs;
|
|
67
|
+
try {
|
|
68
|
+
mtimeMs = fs_1.default.statSync(cwd).mtimeMs;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
const cached = localeFilesCache.get(cwd);
|
|
74
|
+
if (cached && cached.mtimeMs === mtimeMs) {
|
|
75
|
+
return cached.files;
|
|
76
|
+
}
|
|
77
|
+
const files = (0, fast_glob_1.sync)('*.json', { cwd, absolute: true });
|
|
78
|
+
localeFilesCache.set(cwd, { mtimeMs, files });
|
|
79
|
+
return files;
|
|
59
80
|
}
|
|
60
81
|
exports.getLocaleFiles = getLocaleFiles;
|
|
61
82
|
function initLocales(dir, withMessages = true) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (withMessages) {
|
|
72
|
-
(0, shared_1.extend)(res[locale] || (res[locale] = {}), parseLocaleJson(path_1.default.join(dir, filename)));
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
res[locale] = {};
|
|
76
|
-
}
|
|
83
|
+
return getLocaleFiles(dir).reduce((res, filepath) => {
|
|
84
|
+
const filename = path_1.default.basename(filepath);
|
|
85
|
+
try {
|
|
86
|
+
const locale = filename.replace(/(uni-app.)?(.*).json/, '$2');
|
|
87
|
+
if (withMessages) {
|
|
88
|
+
(0, shared_1.extend)(res[locale] || (res[locale] = {}), parseLocaleJson(filepath));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
res[locale] = {};
|
|
77
92
|
}
|
|
78
|
-
catch (e) { }
|
|
79
93
|
}
|
|
94
|
+
catch { }
|
|
80
95
|
return res;
|
|
81
96
|
}, {});
|
|
82
97
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export * from './platform';
|
|
|
26
26
|
export * from './utsUtils';
|
|
27
27
|
export * from './workers';
|
|
28
28
|
export { parseUniExtApi, parseUniExtApis, parseInjects, Define, DefineOptions, Defines, getUniExtApiProviderRegisters, formatExtApiProviderName, } from './uni_modules';
|
|
29
|
-
export {
|
|
29
|
+
export { getUniModulesEncryptType, parseUniModulesArtifacts, resolveEncryptUniModule, } from './uni_modules.cloud';
|
|
30
30
|
import type { EncryptPackageJson } from './uni_modules.cloud';
|
|
31
31
|
export type EncryptArtifacts = EncryptPackageJson['uni_modules']['artifacts'];
|
|
32
32
|
export { M } from './messages';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.checkUpdate = exports.M = exports.resolveEncryptUniModule = exports.parseUniModulesArtifacts = exports.getUniModulesEncryptType = exports.
|
|
17
|
+
exports.checkUpdate = exports.M = exports.resolveEncryptUniModule = exports.parseUniModulesArtifacts = exports.getUniModulesEncryptType = exports.formatExtApiProviderName = exports.getUniExtApiProviderRegisters = exports.parseInjects = exports.parseUniExtApis = exports.parseUniExtApi = void 0;
|
|
18
18
|
__exportStar(require("./fs"), exports);
|
|
19
19
|
__exportStar(require("./mp"), exports);
|
|
20
20
|
__exportStar(require("./url"), exports);
|
|
@@ -49,7 +49,6 @@ Object.defineProperty(exports, "parseInjects", { enumerable: true, get: function
|
|
|
49
49
|
Object.defineProperty(exports, "getUniExtApiProviderRegisters", { enumerable: true, get: function () { return uni_modules_1.getUniExtApiProviderRegisters; } });
|
|
50
50
|
Object.defineProperty(exports, "formatExtApiProviderName", { enumerable: true, get: function () { return uni_modules_1.formatExtApiProviderName; } });
|
|
51
51
|
var uni_modules_cloud_1 = require("./uni_modules.cloud");
|
|
52
|
-
Object.defineProperty(exports, "copyEncryptUniModulesDom2Bytes", { enumerable: true, get: function () { return uni_modules_cloud_1.copyEncryptUniModulesDom2Bytes; } });
|
|
53
52
|
Object.defineProperty(exports, "getUniModulesEncryptType", { enumerable: true, get: function () { return uni_modules_cloud_1.getUniModulesEncryptType; } });
|
|
54
53
|
Object.defineProperty(exports, "parseUniModulesArtifacts", { enumerable: true, get: function () { return uni_modules_cloud_1.parseUniModulesArtifacts; } });
|
|
55
54
|
Object.defineProperty(exports, "resolveEncryptUniModule", { enumerable: true, get: function () { return uni_modules_cloud_1.resolveEncryptUniModule; } });
|
|
@@ -117,15 +117,7 @@ function initUniStatistics(manifestJson) {
|
|
|
117
117
|
if (!uniStatistics) {
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
* 判断是否为私有版统计:
|
|
122
|
-
* - 新配置:type === 'private'
|
|
123
|
-
* - 旧配置兼容:version === 2
|
|
124
|
-
*/
|
|
125
|
-
const isPrivateStat = uniStatistics.type === 'private' ||
|
|
126
|
-
uniStatistics.version === 2 ||
|
|
127
|
-
uniStatistics.version === '2';
|
|
128
|
-
if (isPrivateStat) {
|
|
120
|
+
if (uniStatistics.version === 2 || uniStatistics.version === '2') {
|
|
129
121
|
if (uniStatistics.uniCloud && uniStatistics.uniCloud.spaceId) {
|
|
130
122
|
return;
|
|
131
123
|
}
|
|
@@ -46,7 +46,7 @@ function defineNVuePageCode(pagesJson) {
|
|
|
46
46
|
}
|
|
47
47
|
const pagePathWithExtname = (0, utils_1.normalizePagePath)(page.path, 'app');
|
|
48
48
|
if (pagePathWithExtname) {
|
|
49
|
-
importNVuePagesCode.push(`import('./${pagePathWithExtname}').then((res)=>
|
|
49
|
+
importNVuePagesCode.push(`import('./${pagePathWithExtname}').then((res)=>res.default)`);
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
return importNVuePagesCode.join('\n');
|
package/dist/logs/console.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.appendConsoleExpr = exports.restoreConsoleExpr = exports.rewriteConsoleExpr = void 0;
|
|
7
7
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
|
+
const x_1 = require("../x");
|
|
9
10
|
function rewriteConsoleExpr(method, id, filename, code, sourceMap = false) {
|
|
10
11
|
filename = (0, utils_1.normalizePath)(filename);
|
|
11
12
|
const re = /(console\.(log|info|debug|warn|error))\s*\(([^)]+)\)/g;
|
|
@@ -19,12 +20,25 @@ function rewriteConsoleExpr(method, id, filename, code, sourceMap = false) {
|
|
|
19
20
|
if (s.hasChanged()) {
|
|
20
21
|
return {
|
|
21
22
|
code: s.toString(),
|
|
22
|
-
map: sourceMap
|
|
23
|
+
map: sourceMap
|
|
24
|
+
? normalizeSourceMap(s.generateMap({ hires: (0, x_1.shouldUseHighResolutionSourceMap)() }))
|
|
25
|
+
: { mappings: '' },
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
return { code, map: null };
|
|
26
29
|
}
|
|
27
30
|
exports.rewriteConsoleExpr = rewriteConsoleExpr;
|
|
31
|
+
function normalizeSourceMap(map) {
|
|
32
|
+
return {
|
|
33
|
+
...map,
|
|
34
|
+
file: map.file || '',
|
|
35
|
+
names: map.names || [],
|
|
36
|
+
sources: map.sources || [],
|
|
37
|
+
sourcesContent: map.sourcesContent || [],
|
|
38
|
+
toString: () => map.toString(),
|
|
39
|
+
toUrl: () => map.toUrl(),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
28
42
|
function restoreConsoleExpr(code) {
|
|
29
43
|
return code.replace(/(?:uni\.)?__f__\('([^']+)','at ([^:]+):(\d+)',/g, 'console.$1(');
|
|
30
44
|
}
|
package/dist/messages/en.d.ts
CHANGED
|
@@ -15,17 +15,15 @@ declare const _default: {
|
|
|
15
15
|
readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
|
|
16
16
|
readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
|
|
17
17
|
readonly 'dev.watching.restart.vapor': "DONE Restart required. Switching vapor mode requires restarting to take effect.";
|
|
18
|
-
readonly 'dev.watching.vapor.render.target': "vapor-render-target in manifest.json was changed to {manifestTarget}, but the running console is still {runtimeTarget}.";
|
|
19
18
|
readonly 'build.failed': "DONE Build failed.";
|
|
20
19
|
readonly 'compiler.build.failed': "Build failed with errors.";
|
|
21
20
|
readonly 'stat.warn.appid': "The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303";
|
|
22
|
-
readonly 'stat.warn.version': "The uni statistics
|
|
23
|
-
readonly 'stat.warn.tip': "uni statistics
|
|
21
|
+
readonly 'stat.warn.version': "The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat";
|
|
22
|
+
readonly 'stat.warn.tip': "uni statistics version: {version}";
|
|
24
23
|
readonly 'i18n.fallbackLocale.default': "fallbackLocale is missing in manifest.json, use: {locale}";
|
|
25
24
|
readonly 'i18n.fallbackLocale.missing': "./local/{locale}.json is missing";
|
|
26
25
|
readonly 'easycom.conflict': "easycom component conflict: ";
|
|
27
26
|
readonly 'dom2.compatible.component': "Vapor mode does not support the uni-app compatibility component {name}. The implementation file {file} was detected. Please use the standard UTS component implementation for this purpose.";
|
|
28
|
-
readonly 'dom2.root.scroll.view': "Pages are scrollable in Vapor mode. Remove the root scroll-view to avoid nested scrolling. Details: https://doc.dcloud.net.cn/uni-app-x/page.html#disablescroll";
|
|
29
27
|
readonly 'mp.component.args[0]': "The first parameter of {0} must be a static string";
|
|
30
28
|
readonly 'mp.component.args[1]': "{0} requires two parameters";
|
|
31
29
|
readonly 'mp.360.unsupported': "360 is unsupported";
|
package/dist/messages/en.js
CHANGED
|
@@ -17,17 +17,15 @@ exports.default = {
|
|
|
17
17
|
'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}',
|
|
18
18
|
'dev.watching.end.files': 'DONE Build complete. FILES:{files}',
|
|
19
19
|
'dev.watching.restart.vapor': 'DONE Restart required. Switching vapor mode requires restarting to take effect.',
|
|
20
|
-
'dev.watching.vapor.render.target': 'vapor-render-target in manifest.json was changed to {manifestTarget}, but the running console is still {runtimeTarget}.',
|
|
21
20
|
'build.failed': 'DONE Build failed.',
|
|
22
21
|
'compiler.build.failed': 'Build failed with errors.',
|
|
23
22
|
'stat.warn.appid': 'The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303',
|
|
24
|
-
'stat.warn.version': 'The uni statistics
|
|
25
|
-
'stat.warn.tip': 'uni statistics
|
|
23
|
+
'stat.warn.version': 'The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat',
|
|
24
|
+
'stat.warn.tip': 'uni statistics version: {version}',
|
|
26
25
|
'i18n.fallbackLocale.default': 'fallbackLocale is missing in manifest.json, use: {locale}',
|
|
27
26
|
'i18n.fallbackLocale.missing': './local/{locale}.json is missing',
|
|
28
27
|
'easycom.conflict': 'easycom component conflict: ',
|
|
29
28
|
'dom2.compatible.component': 'Vapor mode does not support the uni-app compatibility component {name}. The implementation file {file} was detected. Please use the standard UTS component implementation for this purpose.',
|
|
30
|
-
'dom2.root.scroll.view': 'Pages are scrollable in Vapor mode. Remove the root scroll-view to avoid nested scrolling. Details: https://doc.dcloud.net.cn/uni-app-x/page.html#disablescroll',
|
|
31
29
|
'mp.component.args[0]': 'The first parameter of {0} must be a static string',
|
|
32
30
|
'mp.component.args[1]': '{0} requires two parameters',
|
|
33
31
|
'mp.360.unsupported': '360 is unsupported',
|
package/dist/messages/index.d.ts
CHANGED
|
@@ -15,17 +15,15 @@ export declare const M: {
|
|
|
15
15
|
readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
|
|
16
16
|
readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
|
|
17
17
|
readonly 'dev.watching.restart.vapor': "DONE Restart required. 切换蒸汽模式需要重新运行才能生效。";
|
|
18
|
-
readonly 'dev.watching.vapor.render.target': "manifest.json 中更改了视图层编译目标为{manifestTarget},但注意运行控制台还是{runtimeTarget}。";
|
|
19
18
|
readonly 'build.failed': "DONE Build failed.";
|
|
20
19
|
readonly 'compiler.build.failed': "编译失败";
|
|
21
20
|
readonly 'stat.warn.appid': "当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303";
|
|
22
|
-
readonly 'stat.warn.version': "当前应用未配置
|
|
23
|
-
readonly 'stat.warn.tip': "已开启uni
|
|
21
|
+
readonly 'stat.warn.version': "当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat";
|
|
22
|
+
readonly 'stat.warn.tip': "已开启 uni统计{version} 版本";
|
|
24
23
|
readonly 'i18n.fallbackLocale.default': "当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{locale}";
|
|
25
24
|
readonly 'i18n.fallbackLocale.missing': "当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件";
|
|
26
25
|
readonly 'easycom.conflict': "easycom组件冲突:";
|
|
27
26
|
readonly 'dom2.compatible.component': "蒸汽模式不支持 uni-app 兼容模式组件 {name},检测到其实现文件为 {file}。请改用标准模式的UTS组件实现来实现。";
|
|
28
|
-
readonly 'dom2.root.scroll.view': "蒸汽模式下页面可滚动,建议移除根节点 scroll-view,以避免嵌套滚动。详情: https://doc.dcloud.net.cn/uni-app-x/page.html#disablescroll";
|
|
29
27
|
readonly 'mp.component.args[0]': "{0}的第一个参数必须为静态字符串";
|
|
30
28
|
readonly 'mp.component.args[1]': "{0}需要两个参数";
|
|
31
29
|
readonly 'mp.360.unsupported': "vue3暂不支持360小程序";
|
|
@@ -73,17 +71,15 @@ export declare const M: {
|
|
|
73
71
|
readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
|
|
74
72
|
readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
|
|
75
73
|
readonly 'dev.watching.restart.vapor': "DONE Restart required. Switching vapor mode requires restarting to take effect.";
|
|
76
|
-
readonly 'dev.watching.vapor.render.target': "vapor-render-target in manifest.json was changed to {manifestTarget}, but the running console is still {runtimeTarget}.";
|
|
77
74
|
readonly 'build.failed': "DONE Build failed.";
|
|
78
75
|
readonly 'compiler.build.failed': "Build failed with errors.";
|
|
79
76
|
readonly 'stat.warn.appid': "The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303";
|
|
80
|
-
readonly 'stat.warn.version': "The uni statistics
|
|
81
|
-
readonly 'stat.warn.tip': "uni statistics
|
|
77
|
+
readonly 'stat.warn.version': "The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat";
|
|
78
|
+
readonly 'stat.warn.tip': "uni statistics version: {version}";
|
|
82
79
|
readonly 'i18n.fallbackLocale.default': "fallbackLocale is missing in manifest.json, use: {locale}";
|
|
83
80
|
readonly 'i18n.fallbackLocale.missing': "./local/{locale}.json is missing";
|
|
84
81
|
readonly 'easycom.conflict': "easycom component conflict: ";
|
|
85
82
|
readonly 'dom2.compatible.component': "Vapor mode does not support the uni-app compatibility component {name}. The implementation file {file} was detected. Please use the standard UTS component implementation for this purpose.";
|
|
86
|
-
readonly 'dom2.root.scroll.view': "Pages are scrollable in Vapor mode. Remove the root scroll-view to avoid nested scrolling. Details: https://doc.dcloud.net.cn/uni-app-x/page.html#disablescroll";
|
|
87
83
|
readonly 'mp.component.args[0]': "The first parameter of {0} must be a static string";
|
|
88
84
|
readonly 'mp.component.args[1]': "{0} requires two parameters";
|
|
89
85
|
readonly 'mp.360.unsupported': "360 is unsupported";
|
package/dist/messages/zh_CN.d.ts
CHANGED
|
@@ -15,17 +15,15 @@ declare const _default: {
|
|
|
15
15
|
readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
|
|
16
16
|
readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
|
|
17
17
|
readonly 'dev.watching.restart.vapor': "DONE Restart required. 切换蒸汽模式需要重新运行才能生效。";
|
|
18
|
-
readonly 'dev.watching.vapor.render.target': "manifest.json 中更改了视图层编译目标为{manifestTarget},但注意运行控制台还是{runtimeTarget}。";
|
|
19
18
|
readonly 'build.failed': "DONE Build failed.";
|
|
20
19
|
readonly 'compiler.build.failed': "编译失败";
|
|
21
20
|
readonly 'stat.warn.appid': "当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303";
|
|
22
|
-
readonly 'stat.warn.version': "当前应用未配置
|
|
23
|
-
readonly 'stat.warn.tip': "已开启uni
|
|
21
|
+
readonly 'stat.warn.version': "当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat";
|
|
22
|
+
readonly 'stat.warn.tip': "已开启 uni统计{version} 版本";
|
|
24
23
|
readonly 'i18n.fallbackLocale.default': "当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{locale}";
|
|
25
24
|
readonly 'i18n.fallbackLocale.missing': "当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件";
|
|
26
25
|
readonly 'easycom.conflict': "easycom组件冲突:";
|
|
27
26
|
readonly 'dom2.compatible.component': "蒸汽模式不支持 uni-app 兼容模式组件 {name},检测到其实现文件为 {file}。请改用标准模式的UTS组件实现来实现。";
|
|
28
|
-
readonly 'dom2.root.scroll.view': "蒸汽模式下页面可滚动,建议移除根节点 scroll-view,以避免嵌套滚动。详情: https://doc.dcloud.net.cn/uni-app-x/page.html#disablescroll";
|
|
29
27
|
readonly 'mp.component.args[0]': "{0}的第一个参数必须为静态字符串";
|
|
30
28
|
readonly 'mp.component.args[1]': "{0}需要两个参数";
|
|
31
29
|
readonly 'mp.360.unsupported': "vue3暂不支持360小程序";
|
package/dist/messages/zh_CN.js
CHANGED
|
@@ -17,17 +17,15 @@ exports.default = {
|
|
|
17
17
|
'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}',
|
|
18
18
|
'dev.watching.end.files': 'DONE Build complete. FILES:{files}',
|
|
19
19
|
'dev.watching.restart.vapor': 'DONE Restart required. 切换蒸汽模式需要重新运行才能生效。',
|
|
20
|
-
'dev.watching.vapor.render.target': 'manifest.json 中更改了视图层编译目标为{manifestTarget},但注意运行控制台还是{runtimeTarget}。',
|
|
21
20
|
'build.failed': 'DONE Build failed.',
|
|
22
21
|
'compiler.build.failed': '编译失败',
|
|
23
22
|
'stat.warn.appid': '当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303',
|
|
24
|
-
'stat.warn.version': '当前应用未配置
|
|
25
|
-
'stat.warn.tip': '已开启uni
|
|
23
|
+
'stat.warn.version': '当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat',
|
|
24
|
+
'stat.warn.tip': '已开启 uni统计{version} 版本',
|
|
26
25
|
'i18n.fallbackLocale.default': '当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{locale}',
|
|
27
26
|
'i18n.fallbackLocale.missing': '当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件',
|
|
28
27
|
'easycom.conflict': 'easycom组件冲突:',
|
|
29
28
|
'dom2.compatible.component': '蒸汽模式不支持 uni-app 兼容模式组件 {name},检测到其实现文件为 {file}。请改用标准模式的UTS组件实现来实现。',
|
|
30
|
-
'dom2.root.scroll.view': '蒸汽模式下页面可滚动,建议移除根节点 scroll-view,以避免嵌套滚动。详情: https://doc.dcloud.net.cn/uni-app-x/page.html#disablescroll',
|
|
31
29
|
'mp.component.args[0]': '{0}的第一个参数必须为静态字符串',
|
|
32
30
|
'mp.component.args[1]': '{0}需要两个参数',
|
|
33
31
|
'mp.360.unsupported': 'vue3暂不支持360小程序',
|
package/dist/mp/imports.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { PluginContext } from 'rollup';
|
|
2
1
|
import { type ImportSpecifier } from 'es-module-lexer';
|
|
2
|
+
import type { Rolldown } from 'vite';
|
|
3
|
+
type PluginContext = Rolldown.PluginContext;
|
|
3
4
|
/**
|
|
4
5
|
* 暂时没用
|
|
5
6
|
* @param source
|
|
@@ -10,3 +11,4 @@ import { type ImportSpecifier } from 'es-module-lexer';
|
|
|
10
11
|
export declare function findVueComponentImports(source: string, importer: string, resolve: PluginContext['resolve']): Promise<(ImportSpecifier & {
|
|
11
12
|
i: string;
|
|
12
13
|
})[]>;
|
|
14
|
+
export {};
|
package/dist/mp/template.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Rolldown } from 'vite';
|
|
2
2
|
import type { AttributeNode, DirectiveNode, ElementNode } from '@vue/compiler-core';
|
|
3
3
|
import type { MiniProgramComponentsType } from '../json/mp/types';
|
|
4
|
+
type EmittedAsset = Rolldown.EmittedAsset;
|
|
4
5
|
type LazyElementFn = (node: ElementNode, context: {
|
|
5
6
|
isMiniProgramComponent(name: string): MiniProgramComponentsType | undefined;
|
|
6
7
|
}) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ImportDeclaration, type Program } from '@babel/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Rolldown } from 'vite';
|
|
3
|
+
type PluginContext = Rolldown.PluginContext;
|
|
3
4
|
type BindingComponents = Record<string, {
|
|
4
5
|
tag: string;
|
|
5
6
|
type: 'unknown' | 'setup' | 'self';
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { PluginCreator } from 'postcss';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* PostCSS plugin to boost specificity for page CSS based on externalClasses usage
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* .a -> .a
|
|
9
|
-
* -
|
|
10
|
-
* .foo -> .foo
|
|
11
|
-
* .bar -> .bar
|
|
5
|
+
* For mini-program platforms (mp-*):
|
|
6
|
+
* - If page has no externalClasses usage: no transformation
|
|
7
|
+
* - If page has dynamic externalClasses: all selectors get page prefix
|
|
8
|
+
* .a -> page .a
|
|
9
|
+
* - If page has only static externalClasses: only matching selectors get page prefix
|
|
10
|
+
* .foo -> page .foo (if "foo" is in staticClasses)
|
|
11
|
+
* .bar -> .bar (unchanged, if "bar" is not in staticClasses)
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* This ensures page styles have higher specificity than component styles
|
|
14
|
+
* while minimizing unnecessary transformations for performance
|
|
14
15
|
*/
|
|
15
16
|
declare const externalPlugin: PluginCreator<void>;
|
|
16
17
|
export default externalPlugin;
|
|
@@ -7,17 +7,18 @@ const postcss_selector_parser_1 = __importDefault(require("postcss-selector-pars
|
|
|
7
7
|
const pages_1 = require("../../json/pages");
|
|
8
8
|
const externalClasses_1 = require("../../mp/externalClasses");
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* PostCSS plugin to boost specificity for page CSS based on externalClasses usage
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
15
|
-
* .a -> .a
|
|
16
|
-
* -
|
|
17
|
-
* .foo -> .foo
|
|
18
|
-
* .bar -> .bar
|
|
12
|
+
* For mini-program platforms (mp-*):
|
|
13
|
+
* - If page has no externalClasses usage: no transformation
|
|
14
|
+
* - If page has dynamic externalClasses: all selectors get page prefix
|
|
15
|
+
* .a -> page .a
|
|
16
|
+
* - If page has only static externalClasses: only matching selectors get page prefix
|
|
17
|
+
* .foo -> page .foo (if "foo" is in staticClasses)
|
|
18
|
+
* .bar -> .bar (unchanged, if "bar" is not in staticClasses)
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* This ensures page styles have higher specificity than component styles
|
|
21
|
+
* while minimizing unnecessary transformations for performance
|
|
21
22
|
*/
|
|
22
23
|
const externalPlugin = () => {
|
|
23
24
|
return {
|
|
@@ -26,21 +27,21 @@ const externalPlugin = () => {
|
|
|
26
27
|
const processedRules = new WeakSet();
|
|
27
28
|
return {
|
|
28
29
|
OnceExit(root) {
|
|
29
|
-
//
|
|
30
|
+
// Only mini-program platforms need page selector prepend
|
|
30
31
|
const platform = process.env.UNI_PLATFORM || '';
|
|
31
32
|
if (!platform.startsWith('mp-')) {
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
|
-
//
|
|
35
|
+
// Get file path from postcss source
|
|
35
36
|
const filePath = root.source?.input?.file;
|
|
36
37
|
if (!filePath) {
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
//
|
|
40
|
+
// Only process page files
|
|
40
41
|
if (!(0, pages_1.isUniPageFile)(filePath)) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
|
-
//
|
|
44
|
+
// Get page's externalClasses info
|
|
44
45
|
const externalClassesInfo = (0, externalClasses_1.findPageExternalClasses)(filePath);
|
|
45
46
|
let staticClasses = new Set();
|
|
46
47
|
let hasDynamic = false;
|
|
@@ -54,7 +55,7 @@ const externalPlugin = () => {
|
|
|
54
55
|
hasDynamic = true;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
//
|
|
58
|
+
// If no static classes and no dynamic, skip processing
|
|
58
59
|
if (staticClasses.size === 0 && !hasDynamic) {
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
@@ -67,67 +68,60 @@ const externalPlugin = () => {
|
|
|
67
68
|
};
|
|
68
69
|
};
|
|
69
70
|
function processRule(rule, processedRules, staticClasses, hasDynamic) {
|
|
70
|
-
//
|
|
71
|
+
// Skip already processed rules
|
|
71
72
|
if (processedRules.has(rule)) {
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
|
-
// keyframes
|
|
75
|
+
// Skip keyframes rules
|
|
75
76
|
if (rule.parent &&
|
|
76
77
|
rule.parent.type === 'atrule' &&
|
|
77
78
|
/-?keyframes$/.test(rule.parent.name)) {
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
processedRules.add(rule);
|
|
81
|
-
//
|
|
82
|
+
// Process selector based on externalClasses info
|
|
82
83
|
rule.selector = (0, postcss_selector_parser_1.default)((selectorRoot) => {
|
|
83
84
|
selectorRoot.each((selector) => {
|
|
84
|
-
let classNode;
|
|
85
85
|
if (hasDynamic) {
|
|
86
|
-
//
|
|
87
|
-
|
|
86
|
+
// Dynamic externalClasses: prepend page to all selectors
|
|
87
|
+
prependPageSelector(selector);
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
appendClassAttribute(selector, classNode);
|
|
90
|
+
// Static only: only prepend page if selector contains any staticClasses
|
|
91
|
+
if (selectorContainsClasses(selector, staticClasses)) {
|
|
92
|
+
prependPageSelector(selector);
|
|
93
|
+
}
|
|
95
94
|
}
|
|
96
95
|
});
|
|
97
96
|
}).processSync(rule.selector);
|
|
98
97
|
}
|
|
99
98
|
/**
|
|
100
|
-
*
|
|
101
|
-
* 传入 classes 时,仅在选择器包含目标 class 后才返回最右侧 class,
|
|
102
|
-
* 这样 .a .b 在命中 .a 时也能输出 .a .b[class],符合整体提权预期。
|
|
99
|
+
* Check if selector contains any of the specified classes
|
|
103
100
|
*/
|
|
104
|
-
function
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
if (!lastClassNode) {
|
|
112
|
-
lastClassNode = node;
|
|
113
|
-
}
|
|
114
|
-
if (!classes || classes.has(node.value)) {
|
|
115
|
-
return lastClassNode;
|
|
101
|
+
function selectorContainsClasses(selector, classes) {
|
|
102
|
+
let found = false;
|
|
103
|
+
selector.walk((node) => {
|
|
104
|
+
if (node.type === 'class' && classes.has(node.value)) {
|
|
105
|
+
found = true;
|
|
106
|
+
return false; // stop walking
|
|
116
107
|
}
|
|
117
|
-
}
|
|
108
|
+
});
|
|
109
|
+
return found;
|
|
118
110
|
}
|
|
119
111
|
/**
|
|
120
|
-
*
|
|
121
|
-
* .a -> .a
|
|
122
|
-
* .
|
|
123
|
-
* .a .b -> .a .b[class]
|
|
112
|
+
* Prepend 'page' selector for mini-program platforms
|
|
113
|
+
* .a -> page .a
|
|
114
|
+
* .b .c -> page .b .c
|
|
124
115
|
*/
|
|
125
|
-
function
|
|
126
|
-
selector
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
116
|
+
function prependPageSelector(selector) {
|
|
117
|
+
// Skip if selector already starts with 'page'
|
|
118
|
+
const firstNode = selector.first;
|
|
119
|
+
if (firstNode && firstNode.type === 'tag' && firstNode.value === 'page') {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
// Insert 'page' tag and a combinator (space) at the beginning
|
|
123
|
+
selector.prepend(postcss_selector_parser_1.default.combinator({ value: ' ' }));
|
|
124
|
+
selector.prepend(postcss_selector_parser_1.default.tag({ value: 'page' }));
|
|
131
125
|
}
|
|
132
126
|
externalPlugin.postcss = true;
|
|
133
127
|
exports.default = externalPlugin;
|
|
@@ -49,7 +49,6 @@ export interface EncryptPackageJson {
|
|
|
49
49
|
export declare function initCheckEnv(): Record<string, unknown>;
|
|
50
50
|
export declare function resolveEncryptUniModule(id: string, platform: typeof process.env.UNI_UTS_PLATFORM, isX?: boolean): string | undefined;
|
|
51
51
|
type CloudCompileSdkType = 'utssdk' | 'easycom' | 'all';
|
|
52
|
-
type VaporRenderTarget = 'bytecode' | 'nativecode';
|
|
53
52
|
export interface CloudCompileParams {
|
|
54
53
|
mode: 'development' | 'production';
|
|
55
54
|
packType: 'debug' | 'release';
|
|
@@ -58,11 +57,8 @@ export interface CloudCompileParams {
|
|
|
58
57
|
appname: string;
|
|
59
58
|
platform: typeof process.env.UNI_UTS_PLATFORM;
|
|
60
59
|
'uni-app-x': boolean;
|
|
61
|
-
vapor: boolean;
|
|
62
|
-
vaporRenderTarget?: VaporRenderTarget;
|
|
63
60
|
env: Record<string, string>;
|
|
64
61
|
}
|
|
65
|
-
export declare function validateCloudCompileAppInfo(params: Pick<CloudCompileParams, 'appid' | 'appname'>): string;
|
|
66
62
|
export declare function checkEncryptUniModules(inputDir: string, params: CloudCompileParams, sdkType?: CloudCompileSdkType): Promise<{} | undefined>;
|
|
67
63
|
export declare function getUniModulesEncryptType(pluginId: string): "" | "utssdk" | "easycom" | undefined;
|
|
68
64
|
export declare function parseUniModulesArtifacts(): {
|
|
@@ -71,6 +67,5 @@ export declare function parseUniModulesArtifacts(): {
|
|
|
71
67
|
scopedSlots: string[];
|
|
72
68
|
declaration: string;
|
|
73
69
|
}[];
|
|
74
|
-
export declare function copyEncryptUniModulesDom2Bytes(): boolean | Promise<boolean>;
|
|
75
70
|
export declare function virtualComponentPath(filepath: string): string;
|
|
76
71
|
export {};
|