@plaudit/webpack-extensions 3.12.1 → 3.12.3

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.12.3] - 2026-07-07
9
+ ### Fixed
10
+ - `admin` hooks that were not restricted to an individual page being restricted to only being emitted on non-existent pages
11
+
12
+ ## [3.12.2] - 2026-06-23
13
+ ### Fixed
14
+ - The nice name handling re-breaking for plain entrypoints
15
+
8
16
  ## [3.12.1] - 2026-06-23
9
17
  ### Fixed
10
18
  - The nice name handling not working for blocks
@@ -48,7 +48,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
48
48
  for (let count = 0; finalHandleName in handleNameMap && handleNameMap[finalHandleName] !== src;) {
49
49
  finalHandleName = `${baseFinalHandleName}-${++count}`;
50
50
  }
51
- if (typeof handleName === 'string' || typeof handleName === 'function') {
51
+ if (typeof handleName === 'string' || typeof handleName === 'function' || (handleName && 'niceName' in handleName)) {
52
52
  finalHandleName = (0, shared_1.convertUsageLocationsHandleToEmittableHandle)(handleName, handlePrefix, finalHandleName.substring(handlePrefix.length + 1));
53
53
  }
54
54
  else {
@@ -200,11 +200,14 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
200
200
  for (const [priority, prioritizedHandleList] of PlainEntrypointsConfigFileGeneratorPlugin.separateHandleListByPriority(handleList)) {
201
201
  if (supports_hook_name) {
202
202
  const hookNamedHandleLists = PlainEntrypointsConfigFileGeneratorPlugin.separateHandleListByHookName(prioritizedHandleList);
203
- if (!(0, shared_1.arrayIsLength)(hookNamedHandleLists, 1) || hookNamedHandleLists[0][0] !== "") {
203
+ if (hookNamedHandleLists.named.length > 0) {
204
204
  const hook_name_var = new expressions_1.Var("hook_name", "?string");
205
205
  writer.action(action, writer => {
206
206
  additional_action_code?.before?.(writer);
207
- for (const [hook_name, handles] of hookNamedHandleLists) {
207
+ for (const handle of hookNamedHandleLists.global) {
208
+ writer.call(`wp_enqueue_${handle.type}`, [handle.handle]);
209
+ }
210
+ for (const [hook_name, handles] of hookNamedHandleLists.named) {
208
211
  writer.if(expressions_1.Op.binary(hook_name_var, " === ", hook_name));
209
212
  for (const handle of handles) {
210
213
  writer.call(`wp_enqueue_${handle.type}`, [handle.handle]);
@@ -247,9 +250,16 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
247
250
  * @private
248
251
  */
249
252
  static separateHandleListByHookName(handleItems) {
253
+ const global = [];
250
254
  const lists = new Map();
251
255
  for (const handleItem of handleItems) {
252
256
  const hook_name = handleItem.hook_name ?? "";
257
+ if (hook_name === "" || (Array.isArray(hook_name) && hook_name.includes(""))) {
258
+ // We're going to be handling global hooks (aka those without a name restriction) separately anyway,
259
+ // so there's no sense in mixing them in with the non-global ones
260
+ global.push(handleItem);
261
+ continue;
262
+ }
253
263
  for (const hn of Array.isArray(hook_name) ? hook_name : [hook_name]) {
254
264
  const list = lists.get(hn);
255
265
  if (list) {
@@ -260,15 +270,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
260
270
  }
261
271
  }
262
272
  }
263
- return lists.entries().toArray().sort((a, b) => {
264
- if (a[0] === "") {
265
- return b[0] === "" ? 0 : -1;
266
- }
267
- else if (b[0] === "") {
268
- return 1;
269
- }
270
- return a[0].localeCompare(b[0]);
271
- });
273
+ return { global, named: lists.entries().toArray().sort((a, b) => a[0].localeCompare(b[0])) };
272
274
  }
273
275
  attachUniquePhase(compilation) {
274
276
  compilation.hooks.processAssets.tapPromise({ name: this.constructor.name, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_REPORT }, async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "3.12.1",
3
+ "version": "3.12.3",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "files": [
6
6
  "/dist",
@@ -46,9 +46,9 @@
46
46
  "@plaudit/postcss-color-function": "^5.1.0",
47
47
  "@plaudit/postcss-strip-units": "^3.0.0",
48
48
  "@plaudit/postcss-variables": "^2.0.1",
49
- "@wordpress/dependency-extraction-webpack-plugin": "^6.48.1",
50
- "@wordpress/scripts": "^32.4.1",
51
- "autoprefixer": "^10.5.1",
49
+ "@wordpress/dependency-extraction-webpack-plugin": "^6.50.0",
50
+ "@wordpress/scripts": "^32.6.0",
51
+ "autoprefixer": "^10.5.2",
52
52
  "browser-sync": "^3.0.4",
53
53
  "copy-webpack-plugin": "10.2.4",
54
54
  "css-minimizer-webpack-plugin": "^8.0.0",
@@ -57,7 +57,7 @@
57
57
  "http-proxy-middleware": "^3.0.7",
58
58
  "jsdom": "^29.1.1",
59
59
  "json2php": "^0.0.12",
60
- "postcss": "^8.5.15",
60
+ "postcss": "^8.5.16",
61
61
  "postcss-calc": "^10.1.1",
62
62
  "postcss-functions": "^4.0.2",
63
63
  "postcss-import": "^16.1.1",
@@ -67,7 +67,7 @@
67
67
  "postcss-property-lookup": "^3.0.0",
68
68
  "postcss-reporter": "^7.1.0",
69
69
  "postcss-url": "^10.1.4",
70
- "webpack": "^5.107.2",
70
+ "webpack": "^5.108.4",
71
71
  "webpack-remove-empty-scripts": "^1.1.1",
72
72
  "xml-formatter": "^3.7.0"
73
73
  },