@dcloudio/uni-cli-shared 3.0.0-alpha-4030120240925001 → 3.0.0-alpha-4030120241009001
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/json/index.d.ts +1 -1
- package/dist/json/index.js +2 -1
- package/dist/json/mp/pages.d.ts +1 -1
- package/dist/json/mp/pages.js +6 -1
- package/dist/json/mp/project.d.ts +1 -0
- package/dist/json/mp/project.js +16 -4
- package/dist/json/uni-x/index.d.ts +1 -1
- package/dist/json/uni-x/index.js +16 -4
- package/dist/json/uni-x/manifest.d.ts +1 -0
- package/dist/json/uni-x/manifest.js +9 -1
- package/dist/uts.d.ts +1 -1
- package/dist/uts.js +4 -1
- package/dist/vite/plugins/json.js +4 -0
- package/dist/vite/plugins/uts/uni_modules.js +14 -0
- package/package.json +4 -4
package/dist/json/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export * from './json';
|
|
|
4
4
|
export * from './pages';
|
|
5
5
|
export * from './manifest';
|
|
6
6
|
export * from './theme';
|
|
7
|
-
export { normalizeUniAppXAppPagesJson, normalizeUniAppXAppConfig, checkPagesJson, parseUniXFlexDirection, parseUniXSplashScreen, } from './uni-x';
|
|
7
|
+
export { normalizeUniAppXAppPagesJson, normalizeUniAppXAppConfig, checkPagesJson, parseUniXFlexDirection, parseUniXSplashScreen, parseUniXUniStatistics, } from './uni-x';
|
package/dist/json/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.parseUniXSplashScreen = exports.parseUniXFlexDirection = exports.checkPagesJson = exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = void 0;
|
|
17
|
+
exports.parseUniXUniStatistics = exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = exports.checkPagesJson = exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = void 0;
|
|
18
18
|
__exportStar(require("./mp"), exports);
|
|
19
19
|
__exportStar(require("./app"), exports);
|
|
20
20
|
__exportStar(require("./json"), exports);
|
|
@@ -27,3 +27,4 @@ Object.defineProperty(exports, "normalizeUniAppXAppConfig", { enumerable: true,
|
|
|
27
27
|
Object.defineProperty(exports, "checkPagesJson", { enumerable: true, get: function () { return uni_x_1.checkPagesJson; } });
|
|
28
28
|
Object.defineProperty(exports, "parseUniXFlexDirection", { enumerable: true, get: function () { return uni_x_1.parseUniXFlexDirection; } });
|
|
29
29
|
Object.defineProperty(exports, "parseUniXSplashScreen", { enumerable: true, get: function () { return uni_x_1.parseUniXSplashScreen; } });
|
|
30
|
+
Object.defineProperty(exports, "parseUniXUniStatistics", { enumerable: true, get: function () { return uni_x_1.parseUniXUniStatistics; } });
|
package/dist/json/mp/pages.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ export declare function parseMiniProgramPagesJson(jsonStr: string, platform: Uni
|
|
|
13
13
|
pageJsons: Record<string, PageWindowOptions>;
|
|
14
14
|
nvuePages: string[];
|
|
15
15
|
};
|
|
16
|
-
export declare function mergeMiniProgramAppJson(appJson: Record<string, any>, platformJson?: Record<string, any>): void;
|
|
16
|
+
export declare function mergeMiniProgramAppJson(appJson: Record<string, any>, platformJson?: Record<string, any>, source?: Record<string, any>): void;
|
|
17
17
|
export {};
|
package/dist/json/mp/pages.js
CHANGED
|
@@ -28,7 +28,12 @@ const NON_APP_JSON_KEYS = [
|
|
|
28
28
|
'mergeVirtualHostAttributes',
|
|
29
29
|
'styleIsolation',
|
|
30
30
|
];
|
|
31
|
-
function mergeMiniProgramAppJson(appJson, platformJson = {}) {
|
|
31
|
+
function mergeMiniProgramAppJson(appJson, platformJson = {}, source = {}) {
|
|
32
|
+
Object.keys(source).forEach((key) => {
|
|
33
|
+
if (!project_1.projectKeys.includes(key)) {
|
|
34
|
+
project_1.projectKeys.push(key);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
32
37
|
Object.keys(platformJson).forEach((name) => {
|
|
33
38
|
if (!(0, project_1.isMiniProgramProjectJsonKey)(name) &&
|
|
34
39
|
!NON_APP_JSON_KEYS.includes(name)) {
|
|
@@ -9,6 +9,7 @@ interface ProjectConfig {
|
|
|
9
9
|
miniprogram?: UniApp.PagesJson['condition'];
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
+
export declare const projectKeys: string[];
|
|
12
13
|
export declare function isMiniProgramProjectJsonKey(name: string): boolean;
|
|
13
14
|
export declare function parseMiniProgramProjectJson(jsonStr: string, platform: UniApp.PLATFORM, { template, pagesJson }: ParseMiniProgramProjectJsonOptions): ProjectConfig;
|
|
14
15
|
export {};
|
package/dist/json/mp/project.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseMiniProgramProjectJson = exports.isMiniProgramProjectJsonKey = void 0;
|
|
3
|
+
exports.parseMiniProgramProjectJson = exports.isMiniProgramProjectJsonKey = exports.projectKeys = void 0;
|
|
4
4
|
const shared_1 = require("@vue/shared");
|
|
5
5
|
const merge_1 = require("merge");
|
|
6
6
|
const json_1 = require("../json");
|
|
7
|
-
|
|
7
|
+
exports.projectKeys = [
|
|
8
8
|
'appid',
|
|
9
9
|
'setting',
|
|
10
10
|
'miniprogramRoot',
|
|
@@ -20,7 +20,7 @@ const projectKeys = [
|
|
|
20
20
|
'cloudbaseRoot',
|
|
21
21
|
];
|
|
22
22
|
function isMiniProgramProjectJsonKey(name) {
|
|
23
|
-
return projectKeys.includes(name);
|
|
23
|
+
return exports.projectKeys.includes(name);
|
|
24
24
|
}
|
|
25
25
|
exports.isMiniProgramProjectJsonKey = isMiniProgramProjectJsonKey;
|
|
26
26
|
function parseMiniProgramProjectJson(jsonStr, platform, { template, pagesJson }) {
|
|
@@ -28,9 +28,10 @@ function parseMiniProgramProjectJson(jsonStr, platform, { template, pagesJson })
|
|
|
28
28
|
const manifestJson = (0, json_1.parseJson)(jsonStr);
|
|
29
29
|
if (manifestJson) {
|
|
30
30
|
projectJson.projectname = manifestJson.name;
|
|
31
|
+
// 用户的平台配置
|
|
31
32
|
const platformConfig = manifestJson[platform];
|
|
32
33
|
if (platformConfig) {
|
|
33
|
-
|
|
34
|
+
const setProjectJson = (name) => {
|
|
34
35
|
if ((0, shared_1.hasOwn)(platformConfig, name)) {
|
|
35
36
|
if ((0, shared_1.isPlainObject)(platformConfig[name]) &&
|
|
36
37
|
(0, shared_1.isPlainObject)(projectJson[name])) {
|
|
@@ -42,6 +43,16 @@ function parseMiniProgramProjectJson(jsonStr, platform, { template, pagesJson })
|
|
|
42
43
|
projectJson[name] = platformConfig[name];
|
|
43
44
|
}
|
|
44
45
|
}
|
|
46
|
+
};
|
|
47
|
+
// 读取 template 中的配置
|
|
48
|
+
Object.keys(template).forEach((name) => {
|
|
49
|
+
if (!exports.projectKeys.includes(name)) {
|
|
50
|
+
exports.projectKeys.push(name);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
// common mp config
|
|
54
|
+
exports.projectKeys.forEach((name) => {
|
|
55
|
+
setProjectJson(name);
|
|
45
56
|
});
|
|
46
57
|
// 使用了微信小程序手势系统,自动开启 ES6=>ES5
|
|
47
58
|
platform === 'mp-weixin' &&
|
|
@@ -57,6 +68,7 @@ function parseMiniProgramProjectJson(jsonStr, platform, { template, pagesJson })
|
|
|
57
68
|
}
|
|
58
69
|
projectJson.condition.miniprogram = miniprogram;
|
|
59
70
|
}
|
|
71
|
+
// appid
|
|
60
72
|
if (!projectJson.appid) {
|
|
61
73
|
projectJson.appid = 'touristappid';
|
|
62
74
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './manifest';
|
|
2
2
|
export declare function checkPagesJson(jsonStr: string, inputDir: string): boolean;
|
|
3
3
|
export declare function normalizeUniAppXAppPagesJson(jsonStr: string): UniApp.PagesJson;
|
|
4
4
|
/**
|
package/dist/json/uni-x/index.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
18
|
};
|
|
5
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = exports.checkPagesJson =
|
|
20
|
+
exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = exports.checkPagesJson = void 0;
|
|
7
21
|
const fs_1 = __importDefault(require("fs"));
|
|
8
22
|
const path_1 = __importDefault(require("path"));
|
|
9
23
|
const shared_1 = require("@vue/shared");
|
|
@@ -15,9 +29,7 @@ const uniRoutes_1 = require("../app/pages/uniRoutes");
|
|
|
15
29
|
const uniConfig_1 = require("./uniConfig");
|
|
16
30
|
const utils_2 = require("../../vite/plugins/vitejs/utils");
|
|
17
31
|
const preprocess_1 = require("../../preprocess");
|
|
18
|
-
|
|
19
|
-
Object.defineProperty(exports, "parseUniXFlexDirection", { enumerable: true, get: function () { return manifest_1.parseUniXFlexDirection; } });
|
|
20
|
-
Object.defineProperty(exports, "parseUniXSplashScreen", { enumerable: true, get: function () { return manifest_1.parseUniXSplashScreen; } });
|
|
32
|
+
__exportStar(require("./manifest"), exports);
|
|
21
33
|
function checkPagesJson(jsonStr, inputDir) {
|
|
22
34
|
if (!inputDir) {
|
|
23
35
|
return false;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare function parseUniXFlexDirection(manifestJson: Record<string, any>): any;
|
|
2
2
|
export declare function parseUniXSplashScreen(manifestJson: Record<string, any>): false | object;
|
|
3
|
+
export declare function parseUniXUniStatistics(manifestJson: Record<string, any>): false | object;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = void 0;
|
|
3
|
+
exports.parseUniXUniStatistics = exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = void 0;
|
|
4
4
|
const shared_1 = require("@vue/shared");
|
|
5
5
|
const flexDirs = ['row', 'row-reverse', 'column', 'column-reverse'];
|
|
6
6
|
function parseUniXFlexDirection(manifestJson) {
|
|
@@ -19,3 +19,11 @@ function parseUniXSplashScreen(manifestJson) {
|
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
21
|
exports.parseUniXSplashScreen = parseUniXSplashScreen;
|
|
22
|
+
function parseUniXUniStatistics(manifestJson) {
|
|
23
|
+
const uniStatistics = manifestJson?.['app']?.['uniStatistics'];
|
|
24
|
+
if ((0, shared_1.isPlainObject)(uniStatistics)) {
|
|
25
|
+
return uniStatistics;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
exports.parseUniXUniStatistics = parseUniXUniStatistics;
|
package/dist/uts.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { EasycomMatcher } from './easycom';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function resolveUTSAppModule(platform: typeof process.env.UNI_UTS_PLATFORM, id: string, importer: string, includeUTSSDK?: boolean): string | undefined;
|
|
12
12
|
export declare function resolveUTSModule(id: string, importer: string, includeUTSSDK?: boolean): string | undefined;
|
|
13
|
-
export declare function resolveUTSCompiler(): typeof UTSCompiler;
|
|
13
|
+
export declare function resolveUTSCompiler(throwError?: boolean): typeof UTSCompiler;
|
|
14
14
|
export declare function isUTSComponent(name: string): boolean;
|
|
15
15
|
export declare function getUTSComponentAutoImports(language: 'kotlin' | 'swift'): Record<string, [[string]]>;
|
|
16
16
|
export declare function parseUTSComponent(name: string, type: 'kotlin' | 'swift'): {
|
package/dist/uts.js
CHANGED
|
@@ -105,7 +105,7 @@ function resolveUTSFile(dir, extensions = ['.uts', '.ts', '.js']) {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function resolveUTSCompiler() {
|
|
108
|
+
function resolveUTSCompiler(throwError = false) {
|
|
109
109
|
let compilerPath = '';
|
|
110
110
|
if (process.env.UNI_COMPILE_TARGET === 'ext-api' &&
|
|
111
111
|
process.env.UNI_APP_NEXT_WORKSPACE) {
|
|
@@ -124,6 +124,9 @@ function resolveUTSCompiler() {
|
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
catch (e) {
|
|
127
|
+
if (throwError) {
|
|
128
|
+
throw `Error: Cannot find module '@dcloudio/uni-uts-v1'`;
|
|
129
|
+
}
|
|
127
130
|
let utsCompilerVersion = '';
|
|
128
131
|
try {
|
|
129
132
|
utsCompilerVersion = require('../package.json').version;
|
|
@@ -13,6 +13,10 @@ function uniJsonPlugin() {
|
|
|
13
13
|
name: 'uni:json',
|
|
14
14
|
enforce: 'pre',
|
|
15
15
|
transform(code, id) {
|
|
16
|
+
// 如果已经被其他插件处理过了,就不再处理,比如 commonjs 插件,ICAPRegistrar.json?commonjs-external
|
|
17
|
+
if (id.startsWith('\0')) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
16
20
|
if (path_1.default.extname((0, utils_1.parseVueRequest)(id).filename) !== '.json') {
|
|
17
21
|
return;
|
|
18
22
|
}
|
|
@@ -16,6 +16,7 @@ const utils_2 = require("../../../utils");
|
|
|
16
16
|
const json_1 = require("../../../json");
|
|
17
17
|
const fs_1 = require("../../../fs");
|
|
18
18
|
const context_1 = require("../../../preprocess/context");
|
|
19
|
+
const hbx_1 = require("../../../hbx");
|
|
19
20
|
/* eslint-disable no-restricted-globals */
|
|
20
21
|
const { preprocess } = require('../../../../lib/preprocess');
|
|
21
22
|
function createUniModulesSyncFilePreprocessor(platform, utsPlatform, isX) {
|
|
@@ -129,6 +130,19 @@ function uniUTSAppUniModulesPlugin(options = {}) {
|
|
|
129
130
|
const inputDir = process.env.UNI_INPUT_DIR;
|
|
130
131
|
process.env.UNI_UTS_USING_ROLLUP = 'true';
|
|
131
132
|
const uniModulesDir = (0, utils_2.normalizePath)(path_1.default.resolve(inputDir, 'uni_modules'));
|
|
133
|
+
// 非 x 项目,非 HBuilderX
|
|
134
|
+
if (!isX && !(0, hbx_1.isInHBuilderX)()) {
|
|
135
|
+
try {
|
|
136
|
+
(0, uts_1.resolveUTSCompiler)(true);
|
|
137
|
+
}
|
|
138
|
+
catch (e) {
|
|
139
|
+
return {
|
|
140
|
+
name: 'uni:uts-uni_modules-placeholder',
|
|
141
|
+
apply: 'build',
|
|
142
|
+
enforce: 'pre',
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
132
146
|
const { createUniXKotlinCompilerOnce, createUniXSwiftCompilerOnce, createUniXArkTSCompilerOnce, syncUniModuleFilesByCompiler, resolveTscUniModuleIndexFileName, } = (0, uts_1.resolveUTSCompiler)();
|
|
133
147
|
const uniXKotlinCompiler = process.env.UNI_APP_X_TSC === 'true' &&
|
|
134
148
|
(process.env.UNI_UTS_PLATFORM === 'app-android' ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-4030120241009001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@babel/core": "^7.23.3",
|
|
27
27
|
"@babel/parser": "^7.23.9",
|
|
28
28
|
"@babel/types": "^7.20.7",
|
|
29
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
30
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
29
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-4030120241009001",
|
|
30
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-4030120241009001",
|
|
31
31
|
"@intlify/core-base": "9.1.9",
|
|
32
32
|
"@intlify/shared": "9.1.9",
|
|
33
33
|
"@intlify/vue-devtools": "9.1.9",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@dcloudio/uni-uts-v1": "3.0.0-alpha-
|
|
74
|
+
"@dcloudio/uni-uts-v1": "3.0.0-alpha-4030120241009001",
|
|
75
75
|
"@types/adm-zip": "^0.5.5",
|
|
76
76
|
"@types/babel__code-frame": "^7.0.6",
|
|
77
77
|
"@types/babel__core": "^7.1.19",
|