xhs-mp-compiler-cli 1.9.3 → 1.9.5
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/utils/apm.d.ts
CHANGED
|
@@ -12,7 +12,9 @@ declare class Reporter implements FeatureReporter.IReporter {
|
|
|
12
12
|
reportMlWebComponent(value: string): void;
|
|
13
13
|
reportJSONComponent(name: FeatureReporter.JSONComponent): void;
|
|
14
14
|
reportStyleIsolation(value: string): void;
|
|
15
|
-
|
|
15
|
+
reportAppJSON(name: FeatureReporter.AppExtJSON): void;
|
|
16
|
+
reportExtJSON(name: FeatureReporter.AppExtJSON): void;
|
|
17
|
+
reportDevelopMode(name: FeatureReporter.DevelopMode): void;
|
|
16
18
|
}
|
|
17
19
|
export declare function createReporter(project: Project, option: ICompileAndZipOptions): Reporter | undefined;
|
|
18
20
|
export {};
|
package/dist/utils/apm.js
CHANGED
|
@@ -13,13 +13,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
if (v !== undefined) module.exports = v;
|
|
14
14
|
}
|
|
15
15
|
else if (typeof define === "function" && define.amd) {
|
|
16
|
-
define(["require", "exports", "path", "xhs-mp-utils", "fs-extra"], factory);
|
|
16
|
+
define(["require", "exports", "path", "lodash", "xhs-mp-utils", "fs-extra"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.createReporter = createReporter;
|
|
22
22
|
const path_1 = __importDefault(require("path"));
|
|
23
|
+
const lodash_1 = require("lodash");
|
|
23
24
|
const xhs_mp_utils_1 = require("xhs-mp-utils");
|
|
24
25
|
const fs_extra_1 = require("fs-extra");
|
|
25
26
|
const pkg = require('../../package.json');
|
|
@@ -91,13 +92,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
91
92
|
value,
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
|
-
|
|
95
|
+
reportAppJSON(name) {
|
|
95
96
|
var _a, _b;
|
|
96
97
|
(_b = (_a = this.apm) === null || _a === void 0 ? void 0 : _a.report) === null || _b === void 0 ? void 0 : _b.call(_a, APMKEY, {
|
|
97
98
|
type: xhs_mp_utils_1.FeatureReporter.MODULE.appJSON,
|
|
98
99
|
name,
|
|
99
100
|
});
|
|
100
101
|
}
|
|
102
|
+
reportExtJSON(name) {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
(_b = (_a = this.apm) === null || _a === void 0 ? void 0 : _a.report) === null || _b === void 0 ? void 0 : _b.call(_a, APMKEY, {
|
|
105
|
+
type: xhs_mp_utils_1.FeatureReporter.MODULE.extJSON,
|
|
106
|
+
name,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
reportDevelopMode(name) {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
(_b = (_a = this.apm) === null || _a === void 0 ? void 0 : _a.report) === null || _b === void 0 ? void 0 : _b.call(_a, APMKEY, {
|
|
112
|
+
type: xhs_mp_utils_1.FeatureReporter.MODULE.developMode,
|
|
113
|
+
name,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
101
116
|
}
|
|
102
117
|
__decorate([
|
|
103
118
|
onceByParams
|
|
@@ -116,19 +131,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
116
131
|
], Reporter.prototype, "reportStyleIsolation", null);
|
|
117
132
|
__decorate([
|
|
118
133
|
onceByParams
|
|
119
|
-
], Reporter.prototype, "
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
if (isObject(t)) {
|
|
128
|
-
return Object.keys(t).length === 0;
|
|
129
|
-
}
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
134
|
+
], Reporter.prototype, "reportAppJSON", null);
|
|
135
|
+
__decorate([
|
|
136
|
+
onceByParams
|
|
137
|
+
], Reporter.prototype, "reportExtJSON", null);
|
|
138
|
+
__decorate([
|
|
139
|
+
onceByParams
|
|
140
|
+
], Reporter.prototype, "reportDevelopMode", null);
|
|
132
141
|
function createReporter(project, option) {
|
|
133
142
|
var _a, _b, _c;
|
|
134
143
|
try {
|
|
@@ -150,26 +159,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
150
159
|
base_version: ((_c = project.projectJsonContent) === null || _c === void 0 ? void 0 : _c.libVersion) || ''
|
|
151
160
|
});
|
|
152
161
|
const reporter = new Reporter(apm);
|
|
153
|
-
function
|
|
154
|
-
var _a, _b, _c, _d;
|
|
162
|
+
function reportAppJSON() {
|
|
163
|
+
var _a, _b, _c, _d, _e;
|
|
155
164
|
// 分包
|
|
156
|
-
if ((_a = project.
|
|
157
|
-
reporter.
|
|
165
|
+
if (!(0, lodash_1.isEmpty)(((_a = project.appJsonContent) === null || _a === void 0 ? void 0 : _a.subPackages) || ((_b = project.appJsonContent) === null || _b === void 0 ? void 0 : _b.subpackages))) {
|
|
166
|
+
reporter.reportAppJSON(xhs_mp_utils_1.FeatureReporter.AppExtJSON.subPackages);
|
|
158
167
|
}
|
|
159
168
|
// tabbar
|
|
160
|
-
if (!isEmpty((
|
|
161
|
-
reporter.
|
|
169
|
+
if (!(0, lodash_1.isEmpty)((_c = project.appJsonContent) === null || _c === void 0 ? void 0 : _c.tabBar)) {
|
|
170
|
+
reporter.reportAppJSON(xhs_mp_utils_1.FeatureReporter.AppExtJSON.tabBar);
|
|
162
171
|
}
|
|
163
172
|
// 按需注入
|
|
164
|
-
if ((
|
|
165
|
-
reporter.
|
|
173
|
+
if ((_d = project.appJsonContent) === null || _d === void 0 ? void 0 : _d.lazyCodeLoading) {
|
|
174
|
+
reporter.reportAppJSON(xhs_mp_utils_1.FeatureReporter.AppExtJSON.lazyCodeLoading);
|
|
166
175
|
}
|
|
167
176
|
// 预载
|
|
168
|
-
if (!isEmpty((
|
|
169
|
-
reporter.
|
|
177
|
+
if (!(0, lodash_1.isEmpty)((_e = project.appJsonContent) === null || _e === void 0 ? void 0 : _e.preloadRule)) {
|
|
178
|
+
reporter.reportAppJSON(xhs_mp_utils_1.FeatureReporter.AppExtJSON.preloadRule);
|
|
170
179
|
}
|
|
171
180
|
const componentsMap = project.getComponentsMap();
|
|
172
|
-
if (!isEmpty(componentsMap)) {
|
|
181
|
+
if (!(0, lodash_1.isEmpty)(componentsMap)) {
|
|
173
182
|
// debug(componentsMap)
|
|
174
183
|
for (let key in componentsMap) {
|
|
175
184
|
const style = componentsMap[key].styleIsolation;
|
|
@@ -179,13 +188,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
179
188
|
}
|
|
180
189
|
// 占位组件
|
|
181
190
|
const componentPlaceholder = componentsMap[key].componentPlaceholder;
|
|
182
|
-
if (!isEmpty(componentPlaceholder)) {
|
|
191
|
+
if (!(0, lodash_1.isEmpty)(componentPlaceholder)) {
|
|
183
192
|
reporter.reportJSONComponent(xhs_mp_utils_1.FeatureReporter.JSONComponent.componentPlaceholder);
|
|
184
193
|
}
|
|
185
194
|
}
|
|
186
195
|
}
|
|
187
196
|
}
|
|
188
|
-
|
|
197
|
+
function reportExtJSON() {
|
|
198
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
199
|
+
if ((0, lodash_1.isEmpty)(project.extJsonContent) || !((_a = project.extJsonContent) === null || _a === void 0 ? void 0 : _a.extEnable)) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
// pages
|
|
203
|
+
if (!(0, lodash_1.isEmpty)((_b = project.extJsonContent) === null || _b === void 0 ? void 0 : _b.pages)) {
|
|
204
|
+
reporter.reportExtJSON(xhs_mp_utils_1.FeatureReporter.AppExtJSON.pages);
|
|
205
|
+
}
|
|
206
|
+
// 分包
|
|
207
|
+
if (!(0, lodash_1.isEmpty)(((_c = project.extJsonContent) === null || _c === void 0 ? void 0 : _c.subPackages) || ((_d = project.extJsonContent) === null || _d === void 0 ? void 0 : _d.subpackages))) {
|
|
208
|
+
reporter.reportExtJSON(xhs_mp_utils_1.FeatureReporter.AppExtJSON.subPackages);
|
|
209
|
+
}
|
|
210
|
+
// tabbar
|
|
211
|
+
if (!(0, lodash_1.isEmpty)((_e = project.extJsonContent) === null || _e === void 0 ? void 0 : _e.tabBar)) {
|
|
212
|
+
reporter.reportExtJSON(xhs_mp_utils_1.FeatureReporter.AppExtJSON.tabBar);
|
|
213
|
+
}
|
|
214
|
+
// extPages
|
|
215
|
+
if (!(0, lodash_1.isEmpty)((_f = project.extJsonContent) === null || _f === void 0 ? void 0 : _f.extPages)) {
|
|
216
|
+
reporter.reportExtJSON(xhs_mp_utils_1.FeatureReporter.AppExtJSON.extPages);
|
|
217
|
+
}
|
|
218
|
+
if ((_g = project.extJsonContent) === null || _g === void 0 ? void 0 : _g.extEnable) {
|
|
219
|
+
// 开发模式
|
|
220
|
+
reporter.reportDevelopMode(((_h = project.extJsonContent) === null || _h === void 0 ? void 0 : _h.directCommit)
|
|
221
|
+
? xhs_mp_utils_1.FeatureReporter.DevelopMode.customDevelopment
|
|
222
|
+
: xhs_mp_utils_1.FeatureReporter.DevelopMode.templateDevelopment);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
reportAppJSON();
|
|
226
|
+
reportExtJSON();
|
|
189
227
|
// 统计taro版本
|
|
190
228
|
const vendor = path_1.default.join(project.miniprogramDir, 'vendors.js.LICENSE.txt');
|
|
191
229
|
const taro = path_1.default.join(project.miniprogramDir, 'taro.js');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xhs-mp-compiler-cli",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.5",
|
|
4
4
|
"description": "xhs mp command tool.",
|
|
5
5
|
"preferGlobal": true,
|
|
6
6
|
"category": "esm",
|
|
@@ -94,13 +94,13 @@
|
|
|
94
94
|
"webpack-chain": "^6.5.1",
|
|
95
95
|
"webpack-sources": "^3.2.2",
|
|
96
96
|
"xhs-mp-workerpool": "^9.1.3",
|
|
97
|
-
"xhs-mp-compiler-ml-loader": "3.0.
|
|
98
|
-
"xhs-mp-compiler-utils": "1.9.
|
|
99
|
-
"xhs-mp-pack": "1.9.
|
|
100
|
-
"xhs-mp-project": "1.9.
|
|
101
|
-
"xhs-mp-utils": "1.9.
|
|
102
|
-
"xhs-mp-shared-fs": "1.4.
|
|
103
|
-
"xhs-mp-compiler-sjs-loader": "1.9.
|
|
97
|
+
"xhs-mp-compiler-ml-loader": "3.0.5",
|
|
98
|
+
"xhs-mp-compiler-utils": "1.9.5",
|
|
99
|
+
"xhs-mp-pack": "1.9.5",
|
|
100
|
+
"xhs-mp-project": "1.9.5",
|
|
101
|
+
"xhs-mp-utils": "1.9.5",
|
|
102
|
+
"xhs-mp-shared-fs": "1.4.5",
|
|
103
|
+
"xhs-mp-compiler-sjs-loader": "1.9.5",
|
|
104
104
|
"yauzl": "^2.10.0"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|