xhs-mp-compiler-cli 2.0.8 → 2.0.9

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.
@@ -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
- makePkgsReady(opts: any): Promise<unknown>;
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
@@ -294,7 +294,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
294
294
  }
295
295
  this.pool.emitWorkerMessage = this.emit.bind(this);
296
296
  }
297
- makePkgsReady(opts) {
297
+ doCompilePkgs(opts) {
298
298
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
299
299
  var _a, _b, _c, _d;
300
300
  if (this.watching) {
@@ -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
- if (!this.watching) {
333
- yield this.makePkgsReady(opts);
334
- return;
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
  }
@@ -167,12 +167,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
167
167
  if (fs_extra_1.default.existsSync(parenCacheDir)) {
168
168
  fs_extra_1.default.removeSync(parenCacheDir);
169
169
  }
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
170
  }
177
171
  createCompiler(entryType = constant_config_1.COMPILE_ENTRY.simulator) {
178
172
  const { nodeJsPath } = this.compilerProps;
@@ -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(enableSourcemap ? 'source-map' : false);
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", "../../../plugins/SourceMapDevToolPlugin", "../../../../utils/cache", "../../../../config/constant.config"], factory);
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, [{
@@ -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 = [assets_1.presetAssets, common_1.default];
36
- const servicePresets = [service_1.presetService, common_1.default, babel_1.default];
37
- const renderPresets = [render_1.presetRender, common_1.default, babel_1.default];
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.8",
3
+ "version": "2.0.9",
4
4
  "description": "xhs mp command tool.",
5
5
  "preferGlobal": true,
6
6
  "category": "esm",
@@ -88,18 +88,18 @@
88
88
  "webpack-chain": "^6.5.1",
89
89
  "webpack-sources": "^3.2.2",
90
90
  "xhs-mp-workerpool": "^9.1.3",
91
- "xhs-mp-ml-loader": "2.0.8",
92
- "xhs-mp-compiler-utils": "2.0.8",
93
- "xhs-mp-pack": "2.0.8",
94
- "xhs-mp-project": "2.0.8",
95
- "xhs-mp-shared": "2.0.8",
96
- "xhs-mp-shared-fs": "2.0.8",
97
- "xhs-mp-sjs-loader": "2.0.8",
98
- "xhs-mp-sketch-loader": "2.0.8",
91
+ "xhs-mp-ml-loader": "2.0.9",
92
+ "xhs-mp-compiler-utils": "2.0.9",
93
+ "xhs-mp-pack": "2.0.9",
94
+ "xhs-mp-project": "2.0.9",
95
+ "xhs-mp-shared": "2.0.9",
96
+ "xhs-mp-shared-fs": "2.0.9",
97
+ "xhs-mp-sjs-loader": "2.0.9",
98
+ "xhs-mp-sketch-loader": "2.0.9",
99
99
  "yauzl": "^2.10.0"
100
100
  },
101
101
  "peerDependencies": {
102
- "xhs-mp-ml-parser": "2.0.8"
102
+ "xhs-mp-ml-parser": "2.0.9"
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.8"
126
+ "xhs-mp-ml-parser": "2.0.9"
127
127
  },
128
128
  "scripts": {
129
129
  "version": "formula changelog && git add .",