@plaudit/webpack-extensions 2.44.7 → 2.45.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.
@@ -29,40 +29,18 @@ class ExtensionsConfigFileGeneratorPlugin {
29
29
  await Promise.all(emissionPromises);
30
30
  });
31
31
  compiler.hooks.thisCompilation.tap(this.constructor.name, compilation => {
32
- compilation.hooks.processAssets.tap({
33
- name: `${this.constructor.name}_ProcessAssets`,
34
- stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_ANALYSE
35
- }, compilationAssets => {
36
- const stats = compilation.getStats().toJson({
37
- hash: true,
38
- publicPath: true,
39
- assets: true,
40
- chunks: true,
41
- modules: true,
42
- source: true,
43
- errorDetails: false,
44
- timings: false
45
- });
46
- if (!stats.assets) {
47
- throw new Error("Stats did not include assets despite them being requested");
48
- }
49
- if (!stats.modules) {
50
- throw new Error("Stats did not include modules despite them being requested");
51
- }
32
+ compilation.hooks.afterProcessAssets.tap(`${this.constructor.name}_ProcessAssets`, compilationAssets => {
52
33
  const regex = /^(.+?)-((?:editor-|view-|)(?:style|script|script-module))\.(?:css|m?js)$/i;
53
34
  const mapping = {};
54
- for (const asset of stats.assets) {
55
- if ((asset.chunks?.length ?? -1) > 1 || !asset.size) {
56
- continue;
57
- }
35
+ for (const asset of Object.keys(compilationAssets)) {
58
36
  let match;
59
- if ((match = /^(.+?)-setup.php$/i.exec(asset.name)) && match[1]) {
60
- (mapping[match[1]] ?? (mapping[match[1]] = [{}]))[1] = `${asset.name}`;
37
+ if ((match = /^(.+?)-setup.php$/i.exec(asset)) && match[1]) {
38
+ (mapping[match[1]] ?? (mapping[match[1]] = [{}]))[1] = `${asset}`;
61
39
  }
62
- else if ((match = regex.exec(asset.name)) && match[1] && match[2]) {
40
+ else if ((match = regex.exec(asset)) && match[1] && match[2]) {
63
41
  const resourceInfo = (mapping[match[1]] ?? (mapping[match[1]] = [{}]))[0];
64
42
  const key = match[2].replace(/-[sm]/gi, chars => chars.substring(1).toUpperCase());
65
- (resourceInfo[key] ?? (resourceInfo[key] = [])).push([`plaudit_block-extension_${match[1]}-${match[2]}`, asset.name]);
43
+ (resourceInfo[key] ?? (resourceInfo[key] = [])).push([`plaudit_block-extension_${match[1]}-${match[2]}`, asset]);
66
44
  }
67
45
  }
68
46
  compilation.emitAsset("mapping.config", new webpack_1.sources.RawSource((0, php_serializer_1.default)(mapping)));
@@ -74,9 +74,9 @@ function postcssConfigBuilder(verbose, variables, postCSSFunctions) {
74
74
  require("@plaudit/postcss-variables")({ variables }), // Once
75
75
  require("postcss-functions")({ functions: { ...makeDefaultPostCSSFunctions(variables), ...postCSSFunctions(variables) } }),
76
76
  require("postcss-quantity-queries")(), // Legacy
77
- require("postcss-short-position")(), // Legacy
78
- require("postcss-short-size")(), // Legacy
79
- require("postcss-short-spacing")(), // Legacy
77
+ require("@plaudit/postcss-legacy-shorthand/position")(), // Legacy
78
+ require("@plaudit/postcss-legacy-shorthand/size")(), // Legacy
79
+ require("@plaudit/postcss-legacy-shorthand/spacing")(), // Legacy
80
80
  require("postcss-fallback")(), // Legacy
81
81
  require("postcss-property-lookup")({ logLevel: "warn" }), // Rule
82
82
  require("@plaudit/postcss-strip-units")(), // AtRule, Declaration
@@ -538,7 +538,9 @@ function processIndividualWebpackConfig(config, webpackConfig, sources) {
538
538
  name(_, chunks, cacheGroupKey) {
539
539
  const chunkName = chunks.find(chunk => chunk.name)?.name;
540
540
  // We use "__${cacheGroupKey}__" instead of "${cacheGroupKey}-" to make it easier to remove when generating the filename
541
- return `${node_path_1.default.dirname(chunkName)}/__${cacheGroupKey}__${node_path_1.default.basename(chunkName)}`;
541
+ const filename = `__${cacheGroupKey}__${node_path_1.default.basename(chunkName)}`;
542
+ const dirname = node_path_1.default.dirname(chunkName);
543
+ return dirname === '.' ? filename : `${dirname}/${filename}`;
542
544
  }
543
545
  },
544
546
  default: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.44.7",
3
+ "version": "2.45.1",
4
4
  "license": "UNLICENSED",
5
5
  "scripts": {
6
6
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
@@ -23,7 +23,7 @@
23
23
  "devDependencies": {
24
24
  "@plaudit/gutenberg-api-extensions": "^2.66.1",
25
25
  "@types/browser-sync-webpack-plugin": "^2.2.5",
26
- "@types/node": "^22.14.1",
26
+ "@types/node": "^22.15.3",
27
27
  "@types/postcss-functions": "^4.0.4",
28
28
  "@types/tapable": "^2.2.7",
29
29
  "@types/webpack": "^5.28.5",
@@ -35,6 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@plaudit/postcss-color-function": "^5.0.0",
38
+ "@plaudit/postcss-legacy-shorthand": "^1.0.0",
38
39
  "@plaudit/postcss-silent-extend": "^3.0.0",
39
40
  "@plaudit/postcss-strip-units": "^3.0.0",
40
41
  "@plaudit/postcss-variables": "^1.1.0",
@@ -62,14 +63,11 @@
62
63
  "postcss-property-lookup": "^3.0.0",
63
64
  "postcss-quantity-queries": "^0.5.0",
64
65
  "postcss-reporter": "^7.1.0",
65
- "postcss-short-position": "^4.0.1",
66
- "postcss-short-size": "^4.0.0",
67
- "postcss-short-spacing": "^4.0.0",
68
66
  "postcss-simple-vars": "^7.0.1",
69
67
  "postcss-url": "^10.1.3",
70
68
  "react": "^18.3.1",
71
69
  "react-dom": "^18.3.1",
72
- "webpack": "^5.99.6",
70
+ "webpack": "^5.99.7",
73
71
  "webpack-remove-empty-scripts": "^1.0.4",
74
72
  "xml-formatter": "^3.6.5"
75
73
  },