@dcloudio/uni-cli-shared 3.0.0-alpha-3030120211210002 → 3.0.0-alpha-3030120211215001
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/hbx/alias.js +10 -0
- package/dist/json/mp/jsonFile.d.ts +11 -0
- package/dist/json/mp/jsonFile.js +35 -2
- package/dist/json/mp/pages.js +11 -2
- package/dist/mp/template.d.ts +4 -0
- package/package.json +10 -9
package/dist/hbx/alias.js
CHANGED
|
@@ -15,6 +15,16 @@ const hbxPlugins = {
|
|
|
15
15
|
// pug: 'compile-pug-cli/node_modules/pug',
|
|
16
16
|
};
|
|
17
17
|
function initModuleAlias() {
|
|
18
|
+
const compilerSfcPath = require.resolve('@vue/compiler-sfc');
|
|
19
|
+
const serverRendererPath = require.resolve('@vue/server-renderer');
|
|
20
|
+
module_alias_1.default.addAliases({
|
|
21
|
+
'@vue/shared': require.resolve('@vue/shared'),
|
|
22
|
+
'@vue/compiler-dom': require.resolve('@vue/compiler-dom'),
|
|
23
|
+
'@vue/compiler-sfc': compilerSfcPath,
|
|
24
|
+
'@vue/server-renderer': serverRendererPath,
|
|
25
|
+
'vue/compiler-sfc': compilerSfcPath,
|
|
26
|
+
'vue/server-renderer': serverRendererPath,
|
|
27
|
+
});
|
|
18
28
|
if ((0, env_1.isInHBuilderX)()) {
|
|
19
29
|
Object.keys(hbxPlugins).forEach((name) => {
|
|
20
30
|
module_alias_1.default.addAlias(name, path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, hbxPlugins[name]));
|
|
@@ -2,9 +2,20 @@ import { ComponentJson, PageWindowOptions, UsingComponents } from './types';
|
|
|
2
2
|
export declare function isMiniProgramPageFile(file: string, inputDir?: string): boolean;
|
|
3
3
|
export declare function isMiniProgramPageSfcFile(file: string, inputDir?: string): boolean;
|
|
4
4
|
export declare function hasJsonFile(filename: string): boolean;
|
|
5
|
+
export declare function findJsonFile(filename: string): Record<string, any> | undefined;
|
|
5
6
|
export declare function normalizeJsonFilename(filename: string): string;
|
|
6
7
|
export declare function findChangedJsonFiles(): Map<string, string>;
|
|
7
8
|
export declare function addMiniProgramAppJson(appJson: Record<string, any>): void;
|
|
8
9
|
export declare function addMiniProgramPageJson(filename: string, json: PageWindowOptions): void;
|
|
9
10
|
export declare function addMiniProgramComponentJson(filename: string, json: ComponentJson): void;
|
|
10
11
|
export declare function addMiniProgramUsingComponents(filename: string, json: UsingComponents): void;
|
|
12
|
+
export declare function isMiniProgramUsingComponent(name: string, options: {
|
|
13
|
+
filename: string;
|
|
14
|
+
inputDir: string;
|
|
15
|
+
componentsDir?: string;
|
|
16
|
+
}): boolean;
|
|
17
|
+
export declare function findMiniProgramUsingComponents({ filename, inputDir, componentsDir, }: {
|
|
18
|
+
filename: string;
|
|
19
|
+
inputDir: string;
|
|
20
|
+
componentsDir?: string;
|
|
21
|
+
}): string[];
|
package/dist/json/mp/jsonFile.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.addMiniProgramUsingComponents = exports.addMiniProgramComponentJson = exports.addMiniProgramPageJson = exports.addMiniProgramAppJson = exports.findChangedJsonFiles = exports.normalizeJsonFilename = exports.hasJsonFile = exports.isMiniProgramPageSfcFile = exports.isMiniProgramPageFile = void 0;
|
|
6
|
+
exports.findMiniProgramUsingComponents = exports.isMiniProgramUsingComponent = exports.addMiniProgramUsingComponents = exports.addMiniProgramComponentJson = exports.addMiniProgramPageJson = exports.addMiniProgramAppJson = exports.findChangedJsonFiles = exports.normalizeJsonFilename = exports.findJsonFile = exports.hasJsonFile = exports.isMiniProgramPageSfcFile = exports.isMiniProgramPageFile = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const shared_1 = require("@vue/shared");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
@@ -31,6 +31,13 @@ function hasJsonFile(filename) {
|
|
|
31
31
|
jsonComponentsCache.has(filename));
|
|
32
32
|
}
|
|
33
33
|
exports.hasJsonFile = hasJsonFile;
|
|
34
|
+
function findJsonFile(filename) {
|
|
35
|
+
if (filename === 'app') {
|
|
36
|
+
return appJsonCache;
|
|
37
|
+
}
|
|
38
|
+
return jsonPagesCache.get(filename) || jsonComponentsCache.get(filename);
|
|
39
|
+
}
|
|
40
|
+
exports.findJsonFile = findJsonFile;
|
|
34
41
|
function normalizeJsonFilename(filename) {
|
|
35
42
|
return (0, utils_1.normalizeNodeModules)(filename);
|
|
36
43
|
}
|
|
@@ -38,7 +45,7 @@ exports.normalizeJsonFilename = normalizeJsonFilename;
|
|
|
38
45
|
function findChangedJsonFiles() {
|
|
39
46
|
const changedJsonFiles = new Map();
|
|
40
47
|
function findChangedFile(filename, json) {
|
|
41
|
-
const newJson = (
|
|
48
|
+
const newJson = JSON.parse(JSON.stringify(json));
|
|
42
49
|
if (!newJson.usingComponents) {
|
|
43
50
|
newJson.usingComponents = {};
|
|
44
51
|
}
|
|
@@ -84,3 +91,29 @@ function addMiniProgramUsingComponents(filename, json) {
|
|
|
84
91
|
jsonUsingComponentsCache.set(filename, json);
|
|
85
92
|
}
|
|
86
93
|
exports.addMiniProgramUsingComponents = addMiniProgramUsingComponents;
|
|
94
|
+
function isMiniProgramUsingComponent(name, options) {
|
|
95
|
+
return findMiniProgramUsingComponents(options).includes(name);
|
|
96
|
+
}
|
|
97
|
+
exports.isMiniProgramUsingComponent = isMiniProgramUsingComponent;
|
|
98
|
+
function findMiniProgramUsingComponents({ filename, inputDir, componentsDir, }) {
|
|
99
|
+
if (!componentsDir) {
|
|
100
|
+
return [];
|
|
101
|
+
}
|
|
102
|
+
const globalUsingComponents = appJsonCache && appJsonCache.usingComponents;
|
|
103
|
+
const miniProgramComponents = [];
|
|
104
|
+
if (globalUsingComponents) {
|
|
105
|
+
miniProgramComponents.push(...findMiniProgramUsingComponent(globalUsingComponents, componentsDir));
|
|
106
|
+
}
|
|
107
|
+
const jsonFile = findJsonFile((0, utils_1.removeExt)((0, utils_1.normalizeMiniProgramFilename)(filename, inputDir)));
|
|
108
|
+
if (jsonFile === null || jsonFile === void 0 ? void 0 : jsonFile.usingComponents) {
|
|
109
|
+
miniProgramComponents.push(...findMiniProgramUsingComponent(jsonFile.usingComponents, componentsDir));
|
|
110
|
+
}
|
|
111
|
+
return miniProgramComponents;
|
|
112
|
+
}
|
|
113
|
+
exports.findMiniProgramUsingComponents = findMiniProgramUsingComponents;
|
|
114
|
+
function findMiniProgramUsingComponent(usingComponents, componentsDir) {
|
|
115
|
+
return Object.keys(usingComponents).filter((name) => {
|
|
116
|
+
const path = usingComponents[name];
|
|
117
|
+
return path.includes(componentsDir + '/');
|
|
118
|
+
});
|
|
119
|
+
}
|
package/dist/json/mp/pages.js
CHANGED
|
@@ -84,7 +84,16 @@ function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, su
|
|
|
84
84
|
}
|
|
85
85
|
// window
|
|
86
86
|
if (pagesJson.globalStyle) {
|
|
87
|
-
|
|
87
|
+
const windowOptions = (0, utils_1.parseWindowOptions)(pagesJson.globalStyle, platform, windowOptionsMap);
|
|
88
|
+
const { usingComponents } = windowOptions;
|
|
89
|
+
if (usingComponents) {
|
|
90
|
+
delete windowOptions.usingComponents;
|
|
91
|
+
appJson.usingComponents = usingComponents;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
delete appJson.usingComponents;
|
|
95
|
+
}
|
|
96
|
+
appJson.window = windowOptions;
|
|
88
97
|
}
|
|
89
98
|
// tabBar
|
|
90
99
|
if (pagesJson.tabBar) {
|
|
@@ -94,7 +103,7 @@ function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, su
|
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
105
|
;
|
|
97
|
-
['preloadRule', 'workers'
|
|
106
|
+
['preloadRule', 'workers'].forEach((name) => {
|
|
98
107
|
if ((0, shared_1.hasOwn)(pagesJson, name)) {
|
|
99
108
|
appJson[name] = pagesJson[name];
|
|
100
109
|
}
|
package/dist/mp/template.d.ts
CHANGED
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-3030120211215001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,15 +18,16 @@
|
|
|
18
18
|
"url": "https://github.com/dcloudio/uni-app/issues"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@babel/parser": "^7.
|
|
22
|
-
"@babel/types": "^7.
|
|
23
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
24
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
21
|
+
"@babel/parser": "^7.16.4",
|
|
22
|
+
"@babel/types": "^7.16.0",
|
|
23
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3030120211215001",
|
|
24
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3030120211215001",
|
|
25
25
|
"@rollup/pluginutils": "^4.1.1",
|
|
26
|
-
"@vue/compiler-core": "3.2.
|
|
27
|
-
"@vue/compiler-dom": "3.2.
|
|
28
|
-
"@vue/compiler-sfc": "3.2.
|
|
29
|
-
"@vue/
|
|
26
|
+
"@vue/compiler-core": "3.2.26",
|
|
27
|
+
"@vue/compiler-dom": "3.2.26",
|
|
28
|
+
"@vue/compiler-sfc": "3.2.26",
|
|
29
|
+
"@vue/server-renderer": "3.2.26",
|
|
30
|
+
"@vue/shared": "3.2.26",
|
|
30
31
|
"base64url": "^3.0.1",
|
|
31
32
|
"chalk": "^4.1.1",
|
|
32
33
|
"chokidar": "^3.5.2",
|