@dcloudio/uni-cli-shared 3.0.0-alpha-3030420211228002 → 3.0.0-alpha-3030420211228003
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/pages.d.ts +13 -0
- package/dist/json/pages.js +26 -2
- package/package.json +3 -3
package/dist/json/pages.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
export declare function isUniPageFile(file: string, inputDir?: string): boolean;
|
|
2
2
|
export declare function isUniPageSfcFile(file: string, inputDir?: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* 小程序平台慎用,因为该解析不支持 subpackages
|
|
5
|
+
* @param inputDir
|
|
6
|
+
* @param platform
|
|
7
|
+
* @param normalize
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
3
10
|
export declare const parsePagesJson: (inputDir: string, platform: UniApp.PLATFORM, normalize?: boolean) => UniApp.PagesJson;
|
|
11
|
+
/**
|
|
12
|
+
* 该方法解析出来的是不支持 subpackages,会被合并入 pages
|
|
13
|
+
*/
|
|
4
14
|
export declare const parsePagesJsonOnce: (inputDir: string, platform: UniApp.PLATFORM, normalize?: boolean) => UniApp.PagesJson;
|
|
5
15
|
/**
|
|
6
16
|
* 目前 App 和 H5 使用了该方法
|
|
@@ -15,3 +25,6 @@ export declare function normalizePagesJson(jsonStr: string, platform: UniApp.PLA
|
|
|
15
25
|
export declare function validatePages(pagesJson: Record<string, any>, jsonStr: string): void;
|
|
16
26
|
export declare function removePlatformStyle(pageStyle: Record<string, any>): Record<string, any>;
|
|
17
27
|
export declare function normalizePagesRoute(pagesJson: UniApp.PagesJson): UniApp.UniRoute[];
|
|
28
|
+
declare function parseSubpackagesRoot(inputDir: string, platform: UniApp.PLATFORM): string[];
|
|
29
|
+
export declare const parseSubpackagesRootOnce: typeof parseSubpackagesRoot;
|
|
30
|
+
export {};
|
package/dist/json/pages.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.normalizePagesRoute = exports.removePlatformStyle = exports.validatePages = exports.normalizePagesJson = exports.parsePagesJsonOnce = exports.parsePagesJson = exports.isUniPageSfcFile = exports.isUniPageFile = void 0;
|
|
6
|
+
exports.parseSubpackagesRootOnce = exports.normalizePagesRoute = exports.removePlatformStyle = exports.validatePages = exports.normalizePagesJson = exports.parsePagesJsonOnce = exports.parsePagesJson = exports.isUniPageSfcFile = exports.isUniPageFile = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const shared_1 = require("@vue/shared");
|
|
@@ -23,6 +23,13 @@ function isUniPageSfcFile(file, inputDir = process.env.UNI_INPUT_DIR) {
|
|
|
23
23
|
return (0, utils_2.isVueSfcFile)(file) && isUniPageFile(file, inputDir);
|
|
24
24
|
}
|
|
25
25
|
exports.isUniPageSfcFile = isUniPageSfcFile;
|
|
26
|
+
/**
|
|
27
|
+
* 小程序平台慎用,因为该解析不支持 subpackages
|
|
28
|
+
* @param inputDir
|
|
29
|
+
* @param platform
|
|
30
|
+
* @param normalize
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
26
33
|
const parsePagesJson = (inputDir, platform, normalize = true) => {
|
|
27
34
|
const jsonStr = fs_1.default.readFileSync(path_1.default.join(inputDir, 'pages.json'), 'utf8');
|
|
28
35
|
if (normalize) {
|
|
@@ -31,6 +38,9 @@ const parsePagesJson = (inputDir, platform, normalize = true) => {
|
|
|
31
38
|
return (0, json_1.parseJson)(jsonStr, true);
|
|
32
39
|
};
|
|
33
40
|
exports.parsePagesJson = parsePagesJson;
|
|
41
|
+
/**
|
|
42
|
+
* 该方法解析出来的是不支持 subpackages,会被合并入 pages
|
|
43
|
+
*/
|
|
34
44
|
exports.parsePagesJsonOnce = (0, uni_shared_1.once)(exports.parsePagesJson);
|
|
35
45
|
/**
|
|
36
46
|
* 目前 App 和 H5 使用了该方法
|
|
@@ -122,7 +132,7 @@ function normalizeSubpackages(subpackages) {
|
|
|
122
132
|
}
|
|
123
133
|
return pages;
|
|
124
134
|
}
|
|
125
|
-
function normalizeSubpackageSubNVues(root, style) {
|
|
135
|
+
function normalizeSubpackageSubNVues(root, style = { navigationBar: {} }) {
|
|
126
136
|
const platformStyle = style['app'] || style['app-plus'];
|
|
127
137
|
if (!platformStyle) {
|
|
128
138
|
return style;
|
|
@@ -351,3 +361,17 @@ function isEnablePullDownRefresh(pageStyle) {
|
|
|
351
361
|
function normalizePullToRefresh(pageStyle) {
|
|
352
362
|
return pageStyle.pullToRefresh;
|
|
353
363
|
}
|
|
364
|
+
function parseSubpackagesRoot(inputDir, platform) {
|
|
365
|
+
const pagesJson = (0, exports.parsePagesJson)(inputDir, platform, false);
|
|
366
|
+
const subpackages = pagesJson.subPackages || pagesJson.subpackages;
|
|
367
|
+
const roots = [];
|
|
368
|
+
if ((0, shared_1.isArray)(subpackages)) {
|
|
369
|
+
subpackages.forEach(({ root }) => {
|
|
370
|
+
if (root) {
|
|
371
|
+
roots.push(root);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
return roots;
|
|
376
|
+
}
|
|
377
|
+
exports.parseSubpackagesRootOnce = (0, uni_shared_1.once)(parseSubpackagesRoot);
|
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-3030420211228003",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"@babel/core": "^7.16.5",
|
|
22
22
|
"@babel/parser": "^7.16.4",
|
|
23
23
|
"@babel/types": "^7.16.0",
|
|
24
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
25
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
24
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3030420211228003",
|
|
25
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3030420211228003",
|
|
26
26
|
"@rollup/pluginutils": "^4.1.2",
|
|
27
27
|
"@vue/compiler-core": "3.2.26",
|
|
28
28
|
"@vue/compiler-dom": "3.2.26",
|