@plaudit/webpack-extensions 2.1.0 → 2.1.1

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.
@@ -19,19 +19,28 @@ class BlockJSONStyleRemappingPlugin {
19
19
  errorDetails: false,
20
20
  timings: false
21
21
  });
22
- const toNumericChunkId = (chunk) => typeof chunk !== 'number' ? parseInt(chunk) : chunk;
23
- const assetSourceFiles = new Map(stats.assets?.map(asset => [asset.name, asset.info?.sourceFilename])
24
- .filter((v) => v[0] !== undefined && v[1] !== undefined) ?? []);
25
- const singleFileChunkToOutputName = new Map(stats.assets?.filter((asset) => asset.chunks?.length === 1)
22
+ if (!stats.assets) {
23
+ throw new Error("Stats did not include assets despite them being requested");
24
+ }
25
+ if (!stats.modules) {
26
+ throw new Error("Stats did not include modules despite them being requested");
27
+ }
28
+ const assetSourceFiles = new Map(stats.assets
29
+ .map(asset => [asset.name, asset.info?.sourceFilename])
30
+ .filter((v) => v[0] !== undefined && v[1] !== undefined));
31
+ const singleFileChunkToOutputName = new Map(stats.assets
32
+ .filter((asset) => asset.chunks?.length === 1)
26
33
  .filter(asset => !asset.name.endsWith('.asset.php'))
27
- .map(asset => [toNumericChunkId(asset.chunks[0]), asset.name]) ?? []);
28
- const singleFileInputToOutputName = new Map(stats.modules?.map(module => {
34
+ .map(asset => [asset.chunks[0], asset.name]));
35
+ const singleFileInputToOutputName = new Map(stats.modules
36
+ .map(module => {
29
37
  if (module.nameForCondition !== undefined && module.chunks?.length === 1) {
30
- const output = singleFileChunkToOutputName.get(toNumericChunkId(module.chunks[0]));
38
+ const output = singleFileChunkToOutputName.get(module.chunks[0]);
31
39
  return output !== undefined ? [module.nameForCondition, output] : undefined;
32
40
  }
33
41
  return undefined;
34
- }).filter((v) => v !== undefined) ?? []);
42
+ })
43
+ .filter((v) => v !== undefined));
35
44
  const remapValue = (value, name, dirname) => {
36
45
  if (value.startsWith("file:")) {
37
46
  const styleInputPath = node_path_1.default.normalize(node_path_1.default.join(compiler.context, dirname, value.substring(5)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "scripts": {
5
5
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
6
6
  "build": "tsc",