xhs-mp-pack 2.0.7 → 2.0.8

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.
@@ -17,7 +17,6 @@ import { Logger } from './base/logging/Logger';
17
17
  import { FileSystemInfo } from './FileSystemInfo';
18
18
  declare class Compilation {
19
19
  static PROCESS_ASSETS_STAGE_DEV_TOOLING: any;
20
- _backCompat: boolean;
21
20
  hooks: any;
22
21
  chunks: any;
23
22
  name: undefined;
@@ -127,11 +126,11 @@ declare class Compilation {
127
126
  getCache(name: any): any;
128
127
  getLogger(name: any): Logger;
129
128
  addModule(module: any, callback: any): void;
130
- _addModule(module: any, callback: any): any;
129
+ private _addModule;
131
130
  getModule(module: any): any;
132
131
  findModule(identifier: any): any;
133
132
  buildModule(module: any, callback: any): void;
134
- _buildModule(module: any, callback: any): void;
133
+ private _buildModule;
135
134
  processModuleDependencies(module: any, callback: any): void;
136
135
  processModuleDependenciesNonRecursive(module: any): void;
137
136
  _processModuleDependencies(module: any, callback: any): any;
@@ -146,7 +145,7 @@ declare class Compilation {
146
145
  recursive?: boolean | undefined;
147
146
  connectOrigin?: any;
148
147
  }, callback: any): void;
149
- _handleModuleBuildAndDependencies(originModule: any, module: any, recursive: any, callback: any): any;
148
+ private _handleModuleBuildAndDependencies;
150
149
  _factorizeModule({ currentProfile, factory, dependencies, originModule, factoryResult, contextInfo, context }: {
151
150
  currentProfile: any;
152
151
  factory: any;
@@ -164,9 +163,9 @@ declare class Compilation {
164
163
  }, callback: any): any;
165
164
  addEntry(context: string, entry: Dependency, optionsOrName: any, callback: any): void;
166
165
  addInclude(context: string, dependency: Dependency, options: any, callback: any): void;
167
- _addEntryItem(context: any, entry: any, target: any, options: any, callback: any): any;
166
+ private _addEntryItem;
168
167
  rebuildModule(module: any, callback: any): void;
169
- _rebuildModule(module: any, callback: any): void;
168
+ private _rebuildModule;
170
169
  _computeAffectedModules(modules: any): void;
171
170
  _computeAffectedModulesWithChunkGraph(): void;
172
171
  finish(callback: any): void;
@@ -123,7 +123,6 @@ const unsafeCacheDependencies = new WeakMap();
123
123
  const unsafeCacheData = new WeakMap();
124
124
  class Compilation {
125
125
  constructor(compiler, params) {
126
- this._backCompat = false;
127
126
  const getNormalModuleLoader = () => deprecatedNormalModuleLoaderHook(this);
128
127
  const processAssetsHook = new tapable_1.AsyncSeriesHook(['assets']);
129
128
  let savedAssets = new Set();
@@ -226,7 +225,7 @@ class Compilation {
226
225
  });
227
226
  const afterProcessAssetsHook = new tapable_1.SyncHook(['assets']);
228
227
  const createProcessAssetsHook = (name, stage, getArgs, code) => {
229
- if (!this._backCompat && code)
228
+ if (code)
230
229
  return undefined;
231
230
  const errorMessage = reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
232
231
  BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
@@ -643,8 +642,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
643
642
  }
644
643
  this._modules.set(identifier, module);
645
644
  this.modules.add(module);
646
- if (this._backCompat)
647
- ModuleGraph_1.default.setModuleGraphForModule(module, this.moduleGraph);
648
645
  if (currentProfile !== undefined) {
649
646
  currentProfile.markIntegrationEnd();
650
647
  }
@@ -954,8 +951,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
954
951
  moduleGraph.setIssuerIfUnset(module, originModule !== undefined ? originModule : null);
955
952
  this._modules.set(module.identifier(), module);
956
953
  this.modules.add(module);
957
- if (this._backCompat)
958
- ModuleGraph_1.default.setModuleGraphForModule(module, this.moduleGraph);
959
954
  this._handleModuleBuildAndDependencies(originModule, module, true, callback);
960
955
  }
961
956
  _handleExistingModuleFromUnsafeCache(originModule, dependency, module) {
@@ -1738,11 +1733,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1738
1733
  };
1739
1734
  const chunkGraph = new ChunkGraph_1.default(this.moduleGraph, this.outputOptions.hashFunction);
1740
1735
  this.chunkGraph = chunkGraph;
1741
- if (this._backCompat) {
1742
- for (const module of this.modules) {
1743
- ChunkGraph_1.default.setChunkGraphForModule(module, chunkGraph);
1744
- }
1745
- }
1746
1736
  this.hooks.seal.call();
1747
1737
  this.logger.time('optimize dependencies');
1748
1738
  while (this.hooks.optimizeDependencies.call(this.modules)) {
@@ -2255,9 +2245,6 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2255
2245
  this.logger.timeEnd('runtime requirements.entries');
2256
2246
  }
2257
2247
  addRuntimeModule(chunk, module, chunkGraph = this.chunkGraph) {
2258
- // Deprecated ModuleGraph association
2259
- if (this._backCompat)
2260
- ModuleGraph_1.default.setModuleGraphForModule(module, this.moduleGraph);
2261
2248
  // add it to the list
2262
2249
  this.modules.add(module);
2263
2250
  this._modules.set(module.identifier(), module);
@@ -2359,10 +2346,8 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2359
2346
  return chunk;
2360
2347
  }
2361
2348
  }
2362
- const chunk = new Chunk_1.default(name, this._backCompat);
2349
+ const chunk = new Chunk_1.default(name);
2363
2350
  this.chunks.add(chunk);
2364
- if (this._backCompat)
2365
- ChunkGraph_1.default.setChunkGraphForChunk(chunk, this.chunkGraph);
2366
2351
  if (name) {
2367
2352
  this.namedChunks.set(name, chunk);
2368
2353
  }
@@ -3202,7 +3187,7 @@ This prevents using hashes of each other and should be avoided.`);
3202
3187
  const runtime = 'build time';
3203
3188
  const { hashFunction, hashDigest, hashDigestLength } = this.outputOptions;
3204
3189
  const runtimeTemplate = this.runtimeTemplate;
3205
- const chunk = new Chunk_1.default('build time chunk', this._backCompat);
3190
+ const chunk = new Chunk_1.default('build time chunk');
3206
3191
  chunk.id = chunk.name;
3207
3192
  chunk.ids = [chunk.id];
3208
3193
  chunk.runtime = runtime;
package/dist/MPPack.d.ts CHANGED
@@ -10,7 +10,6 @@ export declare abstract class AbstractMPPack extends EventEmitter {
10
10
  abstract watch(config: any, callback?: any): any;
11
11
  abstract changeCompileOptions(config: any): any;
12
12
  abstract activatePkgs(compilePkgs: any): any;
13
- abstract reCompilePkgs(config: any): any;
14
13
  abstract build(callback?: any): any;
15
14
  abstract close(callback: any): any;
16
15
  }
@@ -29,7 +28,6 @@ export declare class MPPack extends AbstractMPPack {
29
28
  watch(config: any, callback?: any): Promise<unknown>;
30
29
  changeCompileOptions(config: any): void;
31
30
  activatePkgs(compilePkgs: any): Promise<unknown>;
32
- reCompilePkgs(config: any): Promise<unknown>;
33
31
  build(callback?: any): void;
34
32
  close(callback: any): void;
35
33
  }
package/dist/MPPack.js CHANGED
@@ -170,19 +170,6 @@ class MPPack extends AbstractMPPack {
170
170
  this.callbacks.push(resolve);
171
171
  });
172
172
  }
173
- reCompilePkgs(config) {
174
- return new Promise(resolve => {
175
- var _a;
176
- if (!this.watcher) {
177
- return;
178
- }
179
- if (config) {
180
- this.changeCompileOptions(config);
181
- }
182
- (_a = this.watcher) === null || _a === void 0 ? void 0 : _a.invalidateWithReason(BUILD_REASON.RECOMPILE, () => { });
183
- this.callbacks.push(resolve);
184
- });
185
- }
186
173
  build(callback) {
187
174
  this.compiler.run(callback);
188
175
  }
@@ -23,7 +23,7 @@ declare class Chunk {
23
23
  renderedHash: any;
24
24
  chunkReason: any;
25
25
  extraAsync: boolean;
26
- constructor(name: string, backCompat?: boolean);
26
+ constructor(name: string);
27
27
  get entryModule(): unknown;
28
28
  hasEntryModule(): boolean;
29
29
  addModule(module: any): boolean;
@@ -18,7 +18,7 @@ let debugId = 1000;
18
18
  * Chunks are "rendered" into bundles that get emitted when the build completes.
19
19
  */
20
20
  class Chunk {
21
- constructor(name, backCompat = true) {
21
+ constructor(name) {
22
22
  this.id = null;
23
23
  this.ids = null;
24
24
  this.debugId = debugId++;
@@ -29,7 +29,7 @@ class Chunk {
29
29
  this.cssFilenameTemplate = undefined;
30
30
  this._groups = new SortableSet_1.default(undefined, comparators_1.compareChunkGroupsByIndex);
31
31
  this.runtime = undefined;
32
- this.files = backCompat ? new ChunkFilesSet() : new Set();
32
+ this.files = new Set();
33
33
  this.auxiliaryFiles = new Set();
34
34
  this.rendered = false;
35
35
  this.hash = undefined;
@@ -2,12 +2,6 @@ declare const JAVASCRIPT_MODULE_TYPE_AUTO = "javascript/auto";
2
2
  declare const JAVASCRIPT_MODULE_TYPE_DYNAMIC = "javascript/dynamic";
3
3
  declare const JAVASCRIPT_MODULE_TYPE_ESM = "javascript/esm";
4
4
  declare const JSON_MODULE_TYPE = "json";
5
- declare const WEBASSEMBLY_MODULE_TYPE_ASYNC = "webassembly/async";
6
- declare const WEBASSEMBLY_MODULE_TYPE_SYNC = "webassembly/sync";
7
- declare const CSS_MODULE_TYPE = "css";
8
- declare const CSS_MODULE_TYPE_GLOBAL = "css/global";
9
- declare const CSS_MODULE_TYPE_MODULE = "css/module";
10
- declare const CSS_MODULE_TYPE_AUTO = "css/auto";
11
5
  declare const ASSET_MODULE_TYPE = "asset";
12
6
  declare const ASSET_MODULE_TYPE_INLINE = "asset/inline";
13
7
  declare const ASSET_MODULE_TYPE_RESOURCE = "asset/resource";
@@ -19,4 +13,4 @@ declare const WEBPACK_MODULE_TYPE_REMOTE = "remote-module";
19
13
  declare const WEBPACK_MODULE_TYPE_PROVIDE = "provide-module";
20
14
  declare const WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE = "consume-shared-module";
21
15
  declare const WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = "lazy-compilation-proxy";
22
- export { ASSET_MODULE_TYPE, ASSET_MODULE_TYPE_RAW_DATA_URL, ASSET_MODULE_TYPE_SOURCE, ASSET_MODULE_TYPE_RESOURCE, ASSET_MODULE_TYPE_INLINE, JAVASCRIPT_MODULE_TYPE_AUTO, JAVASCRIPT_MODULE_TYPE_DYNAMIC, JAVASCRIPT_MODULE_TYPE_ESM, JSON_MODULE_TYPE, WEBASSEMBLY_MODULE_TYPE_ASYNC, WEBASSEMBLY_MODULE_TYPE_SYNC, CSS_MODULE_TYPE, CSS_MODULE_TYPE_GLOBAL, CSS_MODULE_TYPE_MODULE, CSS_MODULE_TYPE_AUTO, WEBPACK_MODULE_TYPE_RUNTIME, WEBPACK_MODULE_TYPE_FALLBACK, WEBPACK_MODULE_TYPE_REMOTE, WEBPACK_MODULE_TYPE_PROVIDE, WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE, WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY, };
16
+ export { ASSET_MODULE_TYPE, ASSET_MODULE_TYPE_RAW_DATA_URL, ASSET_MODULE_TYPE_SOURCE, ASSET_MODULE_TYPE_RESOURCE, ASSET_MODULE_TYPE_INLINE, JAVASCRIPT_MODULE_TYPE_AUTO, JAVASCRIPT_MODULE_TYPE_DYNAMIC, JAVASCRIPT_MODULE_TYPE_ESM, JSON_MODULE_TYPE, WEBPACK_MODULE_TYPE_RUNTIME, WEBPACK_MODULE_TYPE_FALLBACK, WEBPACK_MODULE_TYPE_REMOTE, WEBPACK_MODULE_TYPE_PROVIDE, WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE, WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY, };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = exports.WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE = exports.WEBPACK_MODULE_TYPE_PROVIDE = exports.WEBPACK_MODULE_TYPE_REMOTE = exports.WEBPACK_MODULE_TYPE_FALLBACK = exports.WEBPACK_MODULE_TYPE_RUNTIME = exports.CSS_MODULE_TYPE_AUTO = exports.CSS_MODULE_TYPE_MODULE = exports.CSS_MODULE_TYPE_GLOBAL = exports.CSS_MODULE_TYPE = exports.WEBASSEMBLY_MODULE_TYPE_SYNC = exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = exports.JSON_MODULE_TYPE = exports.JAVASCRIPT_MODULE_TYPE_ESM = exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = exports.JAVASCRIPT_MODULE_TYPE_AUTO = exports.ASSET_MODULE_TYPE_INLINE = exports.ASSET_MODULE_TYPE_RESOURCE = exports.ASSET_MODULE_TYPE_SOURCE = exports.ASSET_MODULE_TYPE_RAW_DATA_URL = exports.ASSET_MODULE_TYPE = void 0;
3
+ exports.WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = exports.WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE = exports.WEBPACK_MODULE_TYPE_PROVIDE = exports.WEBPACK_MODULE_TYPE_REMOTE = exports.WEBPACK_MODULE_TYPE_FALLBACK = exports.WEBPACK_MODULE_TYPE_RUNTIME = exports.JSON_MODULE_TYPE = exports.JAVASCRIPT_MODULE_TYPE_ESM = exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = exports.JAVASCRIPT_MODULE_TYPE_AUTO = exports.ASSET_MODULE_TYPE_INLINE = exports.ASSET_MODULE_TYPE_RESOURCE = exports.ASSET_MODULE_TYPE_SOURCE = exports.ASSET_MODULE_TYPE_RAW_DATA_URL = exports.ASSET_MODULE_TYPE = void 0;
4
4
  const JAVASCRIPT_MODULE_TYPE_AUTO = 'javascript/auto';
5
5
  exports.JAVASCRIPT_MODULE_TYPE_AUTO = JAVASCRIPT_MODULE_TYPE_AUTO;
6
6
  const JAVASCRIPT_MODULE_TYPE_DYNAMIC = 'javascript/dynamic';
@@ -9,18 +9,12 @@ const JAVASCRIPT_MODULE_TYPE_ESM = 'javascript/esm';
9
9
  exports.JAVASCRIPT_MODULE_TYPE_ESM = JAVASCRIPT_MODULE_TYPE_ESM;
10
10
  const JSON_MODULE_TYPE = 'json';
11
11
  exports.JSON_MODULE_TYPE = JSON_MODULE_TYPE;
12
- const WEBASSEMBLY_MODULE_TYPE_ASYNC = 'webassembly/async';
13
- exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = WEBASSEMBLY_MODULE_TYPE_ASYNC;
14
- const WEBASSEMBLY_MODULE_TYPE_SYNC = 'webassembly/sync';
15
- exports.WEBASSEMBLY_MODULE_TYPE_SYNC = WEBASSEMBLY_MODULE_TYPE_SYNC;
16
- const CSS_MODULE_TYPE = 'css';
17
- exports.CSS_MODULE_TYPE = CSS_MODULE_TYPE;
18
- const CSS_MODULE_TYPE_GLOBAL = 'css/global';
19
- exports.CSS_MODULE_TYPE_GLOBAL = CSS_MODULE_TYPE_GLOBAL;
20
- const CSS_MODULE_TYPE_MODULE = 'css/module';
21
- exports.CSS_MODULE_TYPE_MODULE = CSS_MODULE_TYPE_MODULE;
22
- const CSS_MODULE_TYPE_AUTO = 'css/auto';
23
- exports.CSS_MODULE_TYPE_AUTO = CSS_MODULE_TYPE_AUTO;
12
+ // const WEBASSEMBLY_MODULE_TYPE_ASYNC = 'webassembly/async'
13
+ // const WEBASSEMBLY_MODULE_TYPE_SYNC = 'webassembly/sync'
14
+ // const CSS_MODULE_TYPE = 'css'
15
+ // const CSS_MODULE_TYPE_GLOBAL = 'css/global'
16
+ // const CSS_MODULE_TYPE_MODULE = 'css/module'
17
+ // const CSS_MODULE_TYPE_AUTO = 'css/auto'
24
18
  const ASSET_MODULE_TYPE = 'asset';
25
19
  exports.ASSET_MODULE_TYPE = ASSET_MODULE_TYPE;
26
20
  const ASSET_MODULE_TYPE_INLINE = 'asset/inline';
@@ -234,10 +234,6 @@ class ModuleConcatenationPlugin {
234
234
  });
235
235
  };
236
236
  const integrate = () => {
237
- // if (backCompat) {
238
- // ChunkGraph.setChunkGraphForModule(newModule, chunkGraph)
239
- // ModuleGraph.setModuleGraphForModule(newModule, moduleGraph)
240
- // }
241
237
  for (const warning of concatConfiguration.getWarningsSorted()) {
242
238
  moduleGraph
243
239
  .getOptimizationBailout(newModule)
@@ -8,9 +8,9 @@ const path_1 = __importDefault(require("path"));
8
8
  function setupWriteToDisk(compiler, MPPackSetting) {
9
9
  compiler.hooks.emit.tap('DevMiddleware', () => {
10
10
  // @ts-ignore
11
- if (compiler.hasDevMiddlewareAssetEmittedCallback) {
12
- return;
13
- }
11
+ // if (compiler.hasDevMiddlewareAssetEmittedCallback) {
12
+ // return
13
+ // }
14
14
  compiler.hooks.assetEmitted.tapAsync('DevMiddleware', (file, info, callback) => {
15
15
  const { targetPath, content } = info;
16
16
  const { writeToDisk: filter } = MPPackSetting;
@@ -32,7 +32,7 @@ function setupWriteToDisk(compiler, MPPackSetting) {
32
32
  });
33
33
  });
34
34
  // @ts-ignore
35
- compiler.hasDevMiddlewareAssetEmittedCallback = true;
35
+ // compiler.hasDevMiddlewareAssetEmittedCallback = true
36
36
  });
37
37
  }
38
38
  exports.default = setupWriteToDisk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xhs-mp-pack",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "xhs mp compiler core.",
5
5
  "preferGlobal": true,
6
6
  "category": "esm",
@@ -55,9 +55,9 @@
55
55
  "watchpack": "^2.4.0",
56
56
  "webpack-chain": "^6.5.1",
57
57
  "webpack-sources": "^3.2.3",
58
- "xhs-mp-compiler-utils": "2.0.7",
59
- "xhs-mp-project": "2.0.7",
60
- "xhs-mp-shared-fs": "2.0.7"
58
+ "xhs-mp-compiler-utils": "2.0.8",
59
+ "xhs-mp-project": "2.0.8",
60
+ "xhs-mp-shared-fs": "2.0.8"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/babel__generator": "7.6.3",