@plaudit/webpack-extensions 2.65.1 → 2.65.2

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.
@@ -22,4 +22,5 @@ export declare class PlainEntrypointsStyleBlockJSONPlugin extends AbstractBiPhas
22
22
  private static remapReferencedPHPFilesOnKey;
23
23
  private static normalizeRenderTemplate;
24
24
  protected attachUniquePhase(compilation: Compilation): void;
25
+ protected attachStandardPhase(compilation: Compilation): void;
25
26
  }
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PlainEntrypointsStyleBlockJSONPlugin = void 0;
7
7
  const node_crypto_1 = __importDefault(require("node:crypto"));
8
+ const promises_1 = __importDefault(require("node:fs/promises"));
8
9
  const node_fs_1 = __importDefault(require("node:fs"));
9
10
  const node_path_1 = __importDefault(require("node:path"));
10
11
  const AbstractBiPhasicGroupAndEntryPlugin_1 = require("./AbstractBiPhasicGroupAndEntryPlugin");
@@ -13,7 +14,6 @@ const shared_1 = require("../shared");
13
14
  const php_writer_1 = require("../utils/php-writer");
14
15
  const pseduo_semaphore_1 = require("../utils/pseduo-semaphore");
15
16
  const webpack_1 = require("webpack");
16
- const promises_1 = __importDefault(require("node:fs/promises"));
17
17
  class PlainEntrypointsStyleBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.AbstractBiPhasicGroupAndEntryPlugin {
18
18
  blocksDest;
19
19
  webpackRemoveEmptyScriptsPlugin;
@@ -31,13 +31,7 @@ class PlainEntrypointsStyleBlockJSONPlugin extends AbstractBiPhasicGroupAndEntry
31
31
  if (node_path_1.default.basename(srcPath).toLowerCase() !== "block.json" || !('purpose' in metadata) || metadata.purpose !== "block-json-inclusion-assurance") {
32
32
  continue;
33
33
  }
34
- const entrypointChunk = entrypoint.getEntrypointChunk();
35
- for (const danglingBlockJsFile of [...entrypointChunk.files, ...entrypointChunk.auxiliaryFiles]) {
36
- if (!danglingBlockJsFile.endsWith("block.json")) {
37
- compilation.deleteAsset(danglingBlockJsFile);
38
- }
39
- }
40
- const asset = [...compilation.chunkGraph.getChunkEntryModulesIterable(entrypointChunk)][0]?.originalSource();
34
+ const asset = [...compilation.chunkGraph.getChunkEntryModulesIterable(entrypoint.getEntrypointChunk())][0]?.originalSource();
41
35
  if (asset) {
42
36
  //TODO: Can we guarantee that entrypoint.name is always non-null?
43
37
  const epBlockJson = entrypoint.name + ".json";
@@ -378,5 +372,22 @@ class PlainEntrypointsStyleBlockJSONPlugin extends AbstractBiPhasicGroupAndEntry
378
372
  this.emitBlockLoaderFile(compilation, blockData);
379
373
  });
380
374
  }
375
+ attachStandardPhase(compilation) {
376
+ super.attachStandardPhase(compilation);
377
+ compilation.hooks.processAssets.tapPromise({ name: `${this.constructor.name}_CompileLoader`, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER }, async () => {
378
+ const relevantEntrypoints = this.getRelevantEntrypoints(compilation).toArray();
379
+ for (const { entrypoint, metadata, srcPath } of relevantEntrypoints) {
380
+ if (node_path_1.default.basename(srcPath).toLowerCase() !== "block.json" || !('purpose' in metadata) || metadata.purpose !== "block-json-inclusion-assurance") {
381
+ continue;
382
+ }
383
+ const entrypointChunk = entrypoint.getEntrypointChunk();
384
+ for (const danglingBlockJsFile of [...entrypointChunk.files, ...entrypointChunk.auxiliaryFiles]) {
385
+ if (!danglingBlockJsFile.endsWith("block.json")) {
386
+ compilation.deleteAsset(danglingBlockJsFile);
387
+ }
388
+ }
389
+ }
390
+ });
391
+ }
381
392
  }
382
393
  exports.PlainEntrypointsStyleBlockJSONPlugin = PlainEntrypointsStyleBlockJSONPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.65.1",
3
+ "version": "2.65.2",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "files": [
6
6
  "/build"