xhs-mp-compiler-cli 2.0.8 → 2.0.10
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/compiler.d.ts +2 -1
- package/dist/compiler.js +16 -20
- package/dist/compilerImpl.d.ts +3 -6
- package/dist/compilerImpl.js +17 -23
- package/dist/compilerManager.js +20 -47
- package/dist/presets/common.js +1 -1
- package/dist/presets/configs/minigame/service/index.js +2 -0
- package/dist/presets/configs/miniprogram/render/index.js +1 -9
- package/dist/presets/configs/miniprogram/service/index.js +2 -0
- package/dist/presets/index.js +3 -3
- package/package.json +12 -12
package/dist/compiler.d.ts
CHANGED
|
@@ -63,7 +63,8 @@ export declare class WebPackDevCompiler extends AbstractCompiler {
|
|
|
63
63
|
private pendingTask?;
|
|
64
64
|
constructor(props: any, args: any);
|
|
65
65
|
makePoolReady(args: any): void;
|
|
66
|
-
|
|
66
|
+
private doCompilePkgs;
|
|
67
|
+
makePkgsReady(opts: any): Promise<void>;
|
|
67
68
|
reCompilePkgs(opts: any): Promise<void>;
|
|
68
69
|
}
|
|
69
70
|
export declare class BuildCompiler extends AbstractCompiler {
|
package/dist/compiler.js
CHANGED
|
@@ -83,6 +83,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
83
83
|
pool === null || pool === void 0 ? void 0 : pool.emitWorkerMessage(payload.event, payload.data);
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
+
workerIns.worker.on('error', (err) => {
|
|
87
|
+
pool === null || pool === void 0 ? void 0 : pool.emitWorkerMessage('uncaughtException', err);
|
|
88
|
+
});
|
|
86
89
|
};
|
|
87
90
|
pool.workers.forEach(workerIns => {
|
|
88
91
|
handlerWorker(workerIns);
|
|
@@ -224,11 +227,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
224
227
|
this.emit('buildStart');
|
|
225
228
|
yield this.call('runTask', Object.assign({ action: 'dev' }, opts));
|
|
226
229
|
this.watching = true;
|
|
227
|
-
this.emit('
|
|
230
|
+
this.emit('buildEnd');
|
|
228
231
|
}
|
|
229
232
|
catch (error) {
|
|
230
233
|
this.watching = false;
|
|
231
|
-
this.emit('buildError', { errors: [error.message] });
|
|
232
234
|
throw error;
|
|
233
235
|
}
|
|
234
236
|
finally {
|
|
@@ -243,10 +245,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
243
245
|
this.pending = true;
|
|
244
246
|
this.emit('buildStart');
|
|
245
247
|
yield this.call('activatePkgs', { compilePkgs });
|
|
246
|
-
this.emit('
|
|
248
|
+
this.emit('buildEnd');
|
|
247
249
|
}
|
|
248
250
|
catch (error) {
|
|
249
|
-
this.emit('buildError', { errors: [error.message] });
|
|
250
251
|
throw error;
|
|
251
252
|
}
|
|
252
253
|
finally {
|
|
@@ -294,7 +295,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
294
295
|
}
|
|
295
296
|
this.pool.emitWorkerMessage = this.emit.bind(this);
|
|
296
297
|
}
|
|
297
|
-
|
|
298
|
+
doCompilePkgs(opts) {
|
|
298
299
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
299
300
|
var _a, _b, _c, _d;
|
|
300
301
|
if (this.watching) {
|
|
@@ -314,12 +315,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
314
315
|
yield this.call('runTask', Object.assign({ action: 'dev' }, opts));
|
|
315
316
|
this.watching = true;
|
|
316
317
|
(_c = this.pendingTask.resolve) === null || _c === void 0 ? void 0 : _c.forEach(fn => fn());
|
|
317
|
-
this.emit('
|
|
318
|
+
this.emit('buildEnd');
|
|
318
319
|
}
|
|
319
320
|
catch (error) {
|
|
320
321
|
this.watching = false;
|
|
321
322
|
(_d = this.pendingTask.reject) === null || _d === void 0 ? void 0 : _d.forEach(fn => fn(error));
|
|
322
|
-
this.emit('buildError', { errors: [error.message] });
|
|
323
323
|
throw error;
|
|
324
324
|
}
|
|
325
325
|
finally {
|
|
@@ -327,21 +327,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
327
327
|
}
|
|
328
328
|
}));
|
|
329
329
|
}
|
|
330
|
+
makePkgsReady(opts) {
|
|
331
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
332
|
+
yield this.doCompilePkgs(opts);
|
|
333
|
+
});
|
|
334
|
+
}
|
|
330
335
|
reCompilePkgs(opts) {
|
|
331
336
|
return __awaiter(this, void 0, void 0, function* () {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
try {
|
|
337
|
-
this.emit('buildStart');
|
|
338
|
-
yield this.call('runTask', Object.assign({ action: 'dev' }, opts));
|
|
339
|
-
this.emit('buildSuccess');
|
|
340
|
-
}
|
|
341
|
-
catch (error) {
|
|
342
|
-
this.emit('buildError', { errors: [error.message] });
|
|
343
|
-
throw error;
|
|
344
|
-
}
|
|
337
|
+
this.pendingTask = undefined;
|
|
338
|
+
this.watching = false;
|
|
339
|
+
this.close();
|
|
340
|
+
yield this.doCompilePkgs(opts);
|
|
345
341
|
});
|
|
346
342
|
}
|
|
347
343
|
}
|
package/dist/compilerImpl.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const workerPool: any;
|
|
2
2
|
declare const createPacker: any;
|
|
3
3
|
declare let globalConfig: any;
|
|
4
4
|
declare let projectPacker: any;
|
|
5
|
-
declare function
|
|
6
|
-
errors: any;
|
|
7
|
-
warnings: any;
|
|
8
|
-
};
|
|
5
|
+
declare function formatOutputError(err: any, stats: any): any;
|
|
9
6
|
declare function sendMessage(data: any): void;
|
|
10
7
|
declare function sendBuildInfoMessage(type: any, message: any): void;
|
|
11
8
|
declare function createProjectPacker(data: any): any;
|
|
12
9
|
declare const handlers: {
|
|
13
|
-
runWatch: (data: any) => Promise<
|
|
10
|
+
runWatch: (data: any) => Promise<void>;
|
|
14
11
|
changeCompileOptions(data: any): void;
|
|
15
12
|
activatePkgs: (data: any) => Promise<void>;
|
|
16
13
|
runBuild: (data: any) => Promise<unknown>;
|
package/dist/compilerImpl.js
CHANGED
|
@@ -8,23 +8,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
const
|
|
11
|
+
const workerPool = require('xhs-mp-workerpool');
|
|
12
12
|
sendBuildInfoMessage('load-packer', '开始加载编译器');
|
|
13
13
|
const { createPacker } = require('./packs');
|
|
14
14
|
sendBuildInfoMessage('load-packer', '加载编译器完成');
|
|
15
15
|
let globalConfig = {};
|
|
16
16
|
let projectPacker;
|
|
17
|
-
function
|
|
17
|
+
function formatOutputError(err, stats) {
|
|
18
18
|
if (err) {
|
|
19
|
-
return
|
|
19
|
+
return err;
|
|
20
20
|
}
|
|
21
21
|
const json = stats.toJson({ warnings: true, errors: true, all: false });
|
|
22
|
-
const formattedErrors = json.errors.map(item => item.message);
|
|
23
|
-
|
|
24
|
-
const result = { errors: formattedErrors, warnings: formattedWarnings };
|
|
25
|
-
return result;
|
|
22
|
+
const formattedErrors = json.errors.map(item => `message: ${item.message}\n`);
|
|
23
|
+
return new Error(formattedErrors.join('\n'));
|
|
26
24
|
}
|
|
27
|
-
//
|
|
25
|
+
// workerPool 只支持在exec期间发送event
|
|
28
26
|
// 这里自己实现sendMessage
|
|
29
27
|
function sendMessage(data) {
|
|
30
28
|
const msg = Object.assign(Object.assign({}, data), { customMessage: true });
|
|
@@ -100,13 +98,12 @@ const handlers = {
|
|
|
100
98
|
// 修改文件时构建
|
|
101
99
|
const hasError = err || ((_a = stats === null || stats === void 0 ? void 0 : stats.hasErrors) === null || _a === void 0 ? void 0 : _a.call(stats));
|
|
102
100
|
if (hasError) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return;
|
|
101
|
+
throw formatOutputError(err, stats);
|
|
102
|
+
// sendMessage({
|
|
103
|
+
// event: 'compileErrorWhenFileChange',
|
|
104
|
+
// data: formatOutputError(err, stats)
|
|
105
|
+
// })
|
|
106
|
+
// return
|
|
110
107
|
}
|
|
111
108
|
sendMessage({
|
|
112
109
|
event: 'compileFinishWhenFileChange'
|
|
@@ -115,10 +112,8 @@ const handlers = {
|
|
|
115
112
|
console.log('[compiler] it is watching...', err, stats);
|
|
116
113
|
const hasError = err || stats.hasErrors();
|
|
117
114
|
if (hasError) {
|
|
118
|
-
|
|
119
|
-
throw error;
|
|
115
|
+
throw formatOutputError(err, stats);
|
|
120
116
|
}
|
|
121
|
-
return stats;
|
|
122
117
|
}),
|
|
123
118
|
changeCompileOptions(data) {
|
|
124
119
|
projectPacker === null || projectPacker === void 0 ? void 0 : projectPacker.changeCompileOptions(data);
|
|
@@ -132,7 +127,7 @@ const handlers = {
|
|
|
132
127
|
console.log('run activate finish', err, stats);
|
|
133
128
|
const hasError = err || ((_c = stats === null || stats === void 0 ? void 0 : stats.hasErrors) === null || _c === void 0 ? void 0 : _c.call(stats));
|
|
134
129
|
if (hasError) {
|
|
135
|
-
throw stats;
|
|
130
|
+
throw formatOutputError(err, stats);
|
|
136
131
|
}
|
|
137
132
|
}),
|
|
138
133
|
runBuild: data => {
|
|
@@ -143,9 +138,8 @@ const handlers = {
|
|
|
143
138
|
var _a;
|
|
144
139
|
const hasError = err || ((_a = stats === null || stats === void 0 ? void 0 : stats.hasErrors) === null || _a === void 0 ? void 0 : _a.call(stats));
|
|
145
140
|
if (hasError) {
|
|
146
|
-
const
|
|
147
|
-
reject(
|
|
148
|
-
return;
|
|
141
|
+
const error = formatOutputError(err, stats);
|
|
142
|
+
return reject(error);
|
|
149
143
|
}
|
|
150
144
|
resolve(null);
|
|
151
145
|
});
|
|
@@ -169,4 +163,4 @@ const handlers = {
|
|
|
169
163
|
globalConfig = null;
|
|
170
164
|
}
|
|
171
165
|
};
|
|
172
|
-
|
|
166
|
+
workerPool.worker(handlers);
|
package/dist/compilerManager.js
CHANGED
|
@@ -54,26 +54,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
54
54
|
compiler.on('buildStart', data => {
|
|
55
55
|
this.emit('simulator-compile-start', data);
|
|
56
56
|
});
|
|
57
|
+
compiler.on('buildEnd', data => {
|
|
58
|
+
this.emit('simulator-compile-end', data);
|
|
59
|
+
});
|
|
57
60
|
compiler.on('compileInfo', data => {
|
|
58
61
|
this.emit('simulator-compile-info', data);
|
|
59
62
|
});
|
|
60
|
-
compiler.on('
|
|
61
|
-
this.emit('simulator-compile-
|
|
63
|
+
compiler.on('compilePercent', data => {
|
|
64
|
+
this.emit('simulator-compile-percent', data);
|
|
62
65
|
});
|
|
63
|
-
compiler.on('
|
|
64
|
-
this.emit('simulator-compile-error',
|
|
66
|
+
compiler.on('compileErrorWhenFileChange', error => {
|
|
67
|
+
this.emit('simulator-file-change-compile-error', error);
|
|
65
68
|
});
|
|
66
69
|
compiler.on('compileFinishWhenFileChange', data => {
|
|
67
70
|
this.emit('simulator-file-change-compile-finish', data);
|
|
68
71
|
});
|
|
69
|
-
compiler.on('
|
|
70
|
-
this.emit('simulator-
|
|
71
|
-
});
|
|
72
|
-
compiler.on('emitCompileStats', data => {
|
|
73
|
-
this.emit('simulator-compile-stats', data);
|
|
74
|
-
});
|
|
75
|
-
compiler.on('unexpectedExit', data => {
|
|
76
|
-
this.emit('simulator-compile-unexpectedExit', data);
|
|
72
|
+
compiler.on('uncaughtException', err => {
|
|
73
|
+
this.emit('simulator-uncaught-exception', err);
|
|
77
74
|
});
|
|
78
75
|
};
|
|
79
76
|
this.initBuildCompiler = compiler => {
|
|
@@ -83,8 +80,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
83
80
|
compiler.on('compileInfo', data => {
|
|
84
81
|
this.emit('full-compiler-info', data);
|
|
85
82
|
});
|
|
86
|
-
compiler.on('
|
|
87
|
-
this.emit('full-compile-
|
|
83
|
+
compiler.on('uncaughtException', err => {
|
|
84
|
+
this.emit('full-compile-uncaught-exception', err);
|
|
88
85
|
});
|
|
89
86
|
};
|
|
90
87
|
const { logger, report, projectPath, project } = props;
|
|
@@ -167,12 +164,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
167
164
|
if (fs_extra_1.default.existsSync(parenCacheDir)) {
|
|
168
165
|
fs_extra_1.default.removeSync(parenCacheDir);
|
|
169
166
|
}
|
|
170
|
-
// 移除编译产物
|
|
171
|
-
const distDir = this.getDistDir();
|
|
172
|
-
const parentDistDir = path_1.default.dirname(distDir);
|
|
173
|
-
if (fs_extra_1.default.existsSync(parentDistDir)) {
|
|
174
|
-
fs_extra_1.default.removeSync(parentDistDir);
|
|
175
|
-
}
|
|
176
167
|
}
|
|
177
168
|
createCompiler(entryType = constant_config_1.COMPILE_ENTRY.simulator) {
|
|
178
169
|
const { nodeJsPath } = this.compilerProps;
|
|
@@ -259,11 +250,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
259
250
|
}
|
|
260
251
|
}
|
|
261
252
|
const config = Object.assign(Object.assign({ compilePkgs, compressCss: false, compressJs: true, enableSourcemap: true, appendSourcemapComment: true, runInServiceSandbox: true, devWriteToDisk: true }, defaultOptions), opts);
|
|
262
|
-
console.log('[compiler]makePkgsReady', config);
|
|
263
253
|
try {
|
|
264
|
-
this.emit('makePkgsReady-start', { config });
|
|
265
254
|
yield compiler.makePkgsReady(config);
|
|
266
|
-
this.emit('makePkgsReady-end', { config });
|
|
267
255
|
(_a = this.report) === null || _a === void 0 ? void 0 : _a.call(this, 'compile', {
|
|
268
256
|
result: 'success',
|
|
269
257
|
entryType,
|
|
@@ -272,7 +260,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
272
260
|
});
|
|
273
261
|
}
|
|
274
262
|
catch (error) {
|
|
275
|
-
this.emit('makePkgsReady-error', { config, error });
|
|
276
263
|
(_b = this.report) === null || _b === void 0 ? void 0 : _b.call(this, 'compile', {
|
|
277
264
|
result: 'fail',
|
|
278
265
|
entryType,
|
|
@@ -292,14 +279,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
292
279
|
const defaultOptions = yield this.getUsingPackageType(entryType);
|
|
293
280
|
const startTime = Date.now();
|
|
294
281
|
const config = Object.assign(Object.assign({ compilePkgs, compressCss: false, compressJs: true, enableSourcemap: true, appendSourcemapComment: true, runInServiceSandbox: true, devWriteToDisk: true }, defaultOptions), opts);
|
|
295
|
-
console.log('[compiler]reCompilePkgs', config);
|
|
296
282
|
try {
|
|
297
|
-
this.emit('recompile-pkgs-start', { config });
|
|
298
283
|
this.removeCacheDir();
|
|
299
284
|
this.removeDistDir();
|
|
300
285
|
(_a = (0, sharedFs_1.default)(true)) === null || _a === void 0 ? void 0 : _a.clear();
|
|
301
286
|
yield compiler.reCompilePkgs(config);
|
|
302
|
-
this.emit('recompile-pkgs-end', { config });
|
|
303
287
|
(_b = this.report) === null || _b === void 0 ? void 0 : _b.call(this, 'compile', {
|
|
304
288
|
result: 'success',
|
|
305
289
|
entryType,
|
|
@@ -308,7 +292,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
308
292
|
});
|
|
309
293
|
}
|
|
310
294
|
catch (error) {
|
|
311
|
-
this.emit('recompile-pkgs-error', { config, error });
|
|
312
295
|
(_c = this.report) === null || _c === void 0 ? void 0 : _c.call(this, 'compile', {
|
|
313
296
|
result: 'fail',
|
|
314
297
|
entryType,
|
|
@@ -321,40 +304,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
321
304
|
}
|
|
322
305
|
compileProject(config) {
|
|
323
306
|
return __awaiter(this, void 0, void 0, function* () {
|
|
324
|
-
var _a, _b, _c, _d
|
|
307
|
+
var _a, _b, _c, _d;
|
|
325
308
|
const { entryType } = config;
|
|
326
309
|
try {
|
|
327
|
-
this.emit('compile-project-start');
|
|
310
|
+
this.emit('full-compile-project-start');
|
|
311
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log('Compile project...');
|
|
328
312
|
const startTime = Date.now();
|
|
329
313
|
const compiler = this.getCompiler(entryType);
|
|
330
314
|
this.removeDistDir(entryType);
|
|
331
|
-
(_a = (0, sharedFs_1.default)(true)) === null || _a === void 0 ? void 0 : _a.clear();
|
|
332
|
-
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.log('Compile project...');
|
|
333
315
|
yield compiler.build(config);
|
|
334
|
-
(
|
|
335
|
-
this.emit('compile-project-end');
|
|
336
|
-
(
|
|
316
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.log('Compile project done...');
|
|
317
|
+
this.emit('full-compile-project-end');
|
|
318
|
+
(_c = this.report) === null || _c === void 0 ? void 0 : _c.call(this, 'compile', {
|
|
337
319
|
result: 'success',
|
|
338
320
|
entryType,
|
|
339
321
|
config: JSON.stringify(config),
|
|
340
322
|
duration: Date.now() - startTime
|
|
341
323
|
});
|
|
342
324
|
}
|
|
343
|
-
catch (
|
|
344
|
-
|
|
345
|
-
if (stats.errors) {
|
|
346
|
-
errors = stats.errors;
|
|
347
|
-
}
|
|
348
|
-
else if (stats instanceof Error) {
|
|
349
|
-
errors = [stats.message];
|
|
350
|
-
}
|
|
351
|
-
this.emit('compile-project-error', { config, errors });
|
|
352
|
-
const error = new Error(errors.join('\n\n'));
|
|
353
|
-
(_e = this.report) === null || _e === void 0 ? void 0 : _e.call(this, 'compile', {
|
|
325
|
+
catch (error) {
|
|
326
|
+
(_d = this.report) === null || _d === void 0 ? void 0 : _d.call(this, 'compile', {
|
|
354
327
|
result: 'fail',
|
|
355
328
|
entryType,
|
|
356
329
|
config: JSON.stringify(config),
|
|
357
|
-
reason: error
|
|
330
|
+
reason: error.message
|
|
358
331
|
});
|
|
359
332
|
throw error;
|
|
360
333
|
}
|
package/dist/presets/common.js
CHANGED
|
@@ -37,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
});
|
|
38
38
|
chain.watch(action === 'dev');
|
|
39
39
|
chain.mode('development');
|
|
40
|
-
chain.devtool(
|
|
40
|
+
chain.devtool(false);
|
|
41
41
|
// @ts-ignore
|
|
42
42
|
chain.target(['web', 'es5']);
|
|
43
43
|
};
|
|
@@ -31,6 +31,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
chain.plugin('InjectorPlugin').use(InjectorPlugin_1.InjectorPlugin, [options]);
|
|
32
32
|
chain.plugin('ServiceEntryPlugin').use(serviceEntryPlugin_1.default, [options]);
|
|
33
33
|
chain.plugin('ServiceChunkPlugin').use(serviceChunkPlugin_1.default, [options]);
|
|
34
|
+
// sourcemap
|
|
35
|
+
chain.devtool(enableSourcemap ? 'source-map' : false);
|
|
34
36
|
if (enableSourcemap && !appendSourcemapComment) {
|
|
35
37
|
const SourceMapDevToolPlugin = (0, SourceMapDevToolPlugin_1.getSourceMapDevtoolPlugin)(options.packMode);
|
|
36
38
|
chain.plugin('SourceMapDevToolPlugin').use(SourceMapDevToolPlugin, [{
|
|
@@ -7,7 +7,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
if (v !== undefined) module.exports = v;
|
|
8
8
|
}
|
|
9
9
|
else if (typeof define === "function" && define.amd) {
|
|
10
|
-
define(["require", "exports", "path", "./sjsEntryPlugin", "./render", "./component", "./sketch", "./renderChunkPlugin", "../../../../types", "../../../plugins/InjectorPlugin", "
|
|
10
|
+
define(["require", "exports", "path", "./sjsEntryPlugin", "./render", "./component", "./sketch", "./renderChunkPlugin", "../../../../types", "../../../plugins/InjectorPlugin", "../../../../utils/cache", "../../../../config/constant.config"], factory);
|
|
11
11
|
}
|
|
12
12
|
})(function (require, exports) {
|
|
13
13
|
"use strict";
|
|
@@ -21,7 +21,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
21
21
|
const renderChunkPlugin_1 = __importDefault(require("./renderChunkPlugin"));
|
|
22
22
|
const types_1 = require("../../../../types");
|
|
23
23
|
const InjectorPlugin_1 = require("../../../plugins/InjectorPlugin");
|
|
24
|
-
const SourceMapDevToolPlugin_1 = require("../../../plugins/SourceMapDevToolPlugin");
|
|
25
24
|
const cache_1 = require("../../../../utils/cache");
|
|
26
25
|
const constant_config_1 = require("../../../../config/constant.config");
|
|
27
26
|
const getRenderEntry = (options) => () => {
|
|
@@ -107,13 +106,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
107
106
|
chain.plugin('InjectorPlugin').use(InjectorPlugin_1.InjectorPlugin, [options]);
|
|
108
107
|
chain.plugin('SjsEntryPlugin').use(sjsEntryPlugin_1.default, [options]);
|
|
109
108
|
chain.plugin("RenderChunkPlugin").use(renderChunkPlugin_1.default, [options]);
|
|
110
|
-
if (enableSourcemap && !appendSourcemapComment) {
|
|
111
|
-
const SourceMapDevToolPlugin = (0, SourceMapDevToolPlugin_1.getSourceMapDevtoolPlugin)(options.packMode);
|
|
112
|
-
chain.plugin('SourceMapDevToolPlugin').use(SourceMapDevToolPlugin, [{
|
|
113
|
-
filename: '[file].map',
|
|
114
|
-
append: false
|
|
115
|
-
}]);
|
|
116
|
-
}
|
|
117
109
|
};
|
|
118
110
|
exports.presetRender = presetRender;
|
|
119
111
|
});
|
|
@@ -65,6 +65,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
65
65
|
} }, (0, cache_1.getCacheConfig)(absCacheDirectory, options)));
|
|
66
66
|
chain.plugin('InjectorPlugin').use(InjectorPlugin_1.InjectorPlugin, [options]);
|
|
67
67
|
chain.plugin('ServiceChunkPlugin').use(serviceChunkPlugin_1.default, [options]);
|
|
68
|
+
// sourcemap
|
|
69
|
+
chain.devtool(enableSourcemap ? 'source-map' : false);
|
|
68
70
|
if (enableSourcemap && !appendSourcemapComment) {
|
|
69
71
|
const SourceMapDevToolPlugin = (0, SourceMapDevToolPlugin_1.getSourceMapDevtoolPlugin)(options.packMode);
|
|
70
72
|
chain.plugin('SourceMapDevToolPlugin').use(SourceMapDevToolPlugin, [{
|
package/dist/presets/index.js
CHANGED
|
@@ -32,9 +32,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
32
|
const assetsChain = new xhs_mp_pack_1.Config();
|
|
33
33
|
const serviceChain = new xhs_mp_pack_1.Config();
|
|
34
34
|
const renderChain = new xhs_mp_pack_1.Config();
|
|
35
|
-
const assetsPresets = [
|
|
36
|
-
const servicePresets = [
|
|
37
|
-
const renderPresets = [
|
|
35
|
+
const assetsPresets = [common_1.default, assets_1.presetAssets];
|
|
36
|
+
const servicePresets = [common_1.default, service_1.presetService, babel_1.default];
|
|
37
|
+
const renderPresets = [common_1.default, render_1.presetRender, babel_1.default];
|
|
38
38
|
if (env === xhs_mp_pack_1.ENV.production) {
|
|
39
39
|
assetsPresets.push(prod_1.default);
|
|
40
40
|
servicePresets.push(prod_1.default);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xhs-mp-compiler-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "xhs mp command tool.",
|
|
5
5
|
"preferGlobal": true,
|
|
6
6
|
"category": "esm",
|
|
@@ -87,19 +87,19 @@
|
|
|
87
87
|
"webpack-bundle-analyzer": "^4.4.0",
|
|
88
88
|
"webpack-chain": "^6.5.1",
|
|
89
89
|
"webpack-sources": "^3.2.2",
|
|
90
|
-
"xhs-mp-workerpool": "^9.
|
|
91
|
-
"xhs-mp-ml-loader": "2.0.
|
|
92
|
-
"xhs-mp-compiler-utils": "2.0.
|
|
93
|
-
"xhs-mp-pack": "2.0.
|
|
94
|
-
"xhs-mp-project": "2.0.
|
|
95
|
-
"xhs-mp-shared": "2.0.
|
|
96
|
-
"xhs-mp-shared-fs": "2.0.
|
|
97
|
-
"xhs-mp-sjs-loader": "2.0.
|
|
98
|
-
"xhs-mp-sketch-loader": "2.0.
|
|
90
|
+
"xhs-mp-workerpool": "^9.2.0",
|
|
91
|
+
"xhs-mp-ml-loader": "2.0.10",
|
|
92
|
+
"xhs-mp-compiler-utils": "2.0.10",
|
|
93
|
+
"xhs-mp-pack": "2.0.10",
|
|
94
|
+
"xhs-mp-project": "2.0.10",
|
|
95
|
+
"xhs-mp-shared": "2.0.10",
|
|
96
|
+
"xhs-mp-shared-fs": "2.0.10",
|
|
97
|
+
"xhs-mp-sjs-loader": "2.0.10",
|
|
98
|
+
"xhs-mp-sketch-loader": "2.0.10",
|
|
99
99
|
"yauzl": "^2.10.0"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
|
-
"xhs-mp-ml-parser": "2.0.
|
|
102
|
+
"xhs-mp-ml-parser": "2.0.10"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@types/babel__generator": "7.6.3",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"typescript": "5.1.6",
|
|
124
124
|
"vue3-jest": "27.0.0-alpha.2",
|
|
125
125
|
"webpack-dev-server": "4.0.0-beta.3",
|
|
126
|
-
"xhs-mp-ml-parser": "2.0.
|
|
126
|
+
"xhs-mp-ml-parser": "2.0.10"
|
|
127
127
|
},
|
|
128
128
|
"scripts": {
|
|
129
129
|
"version": "formula changelog && git add .",
|