@plaudit/webpack-extensions 3.21.0 → 3.21.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.
- package/CHANGELOG.md +66 -44
- package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.js +18 -24
- package/dist/shared.d.ts +14 -6
- package/dist/shared.js +19 -3
- package/dist/utils/location-encoding-filename-parser.d.ts +4 -4
- package/dist/utils/location-encoding-filename-parser.js +12 -16
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js +4 -0
- package/package.json +16 -17
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ 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.21.2] - 2026-10-15
|
|
9
|
+
### Fixed
|
|
10
|
+
- A desync with the dependencies in `@plaudit/gutenberg-api-extensions`
|
|
11
|
+
|
|
12
|
+
## [3.21.1] - 2026-09-04
|
|
13
|
+
### Fixed
|
|
14
|
+
- The `inline` flag not getting picked up if it was set from within the webpack.config.js file
|
|
15
|
+
- Forward-port from `2.99.3`
|
|
16
|
+
- Inlined assets getting put in the registered assets list
|
|
17
|
+
- Forward-port from `2.99.3`
|
|
18
|
+
- An unnecessary call to `plaudit_webpack_extensions__resolve_base_uri` being emitted when a "registration" batch exclusively contains inlined assets
|
|
19
|
+
- Forward-port from `2.99.3`
|
|
20
|
+
|
|
8
21
|
## [3.21.0] - 2026-09-03
|
|
9
22
|
### Added
|
|
10
23
|
- Logic to associate inline scripts with non-inlined scripts that have the same handle for Plain entrypoints
|
|
@@ -13,52 +26,52 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
13
26
|
## [3.20.2] - 2026-09-01
|
|
14
27
|
### Removed
|
|
15
28
|
- The duplicated `isDistDevOutputPath` logic around the initialization of the `@plaudit/dev-webpack-plugin`
|
|
16
|
-
-
|
|
29
|
+
- Forward-port from `2.99.2`
|
|
17
30
|
|
|
18
31
|
## [3.20.1] - 2026-08-26
|
|
19
32
|
### Internals
|
|
20
33
|
- Updated to the 34.x line of `@wordpress/scripts`
|
|
21
|
-
-
|
|
34
|
+
- Forward-port from `2.99.1`
|
|
22
35
|
- Removed the `@types/wordpress` override
|
|
23
|
-
-
|
|
36
|
+
- Forward-port from `2.99.1`
|
|
24
37
|
|
|
25
38
|
## [3.20.0] - 2026-08-24
|
|
26
39
|
### Added
|
|
27
40
|
- Mixable versions of the `BiPhasicGroup...` plugins
|
|
28
|
-
-
|
|
41
|
+
- Forward-port from `2.99.0`
|
|
29
42
|
- Entrypoints to allow other code to reference some of the plugins and utilities
|
|
30
|
-
-
|
|
43
|
+
- Forward-port from `2.99.0`
|
|
31
44
|
|
|
32
45
|
### Internals
|
|
33
46
|
- Dropped unnecessary constructor parameters to make re-using the more general components easier
|
|
34
|
-
-
|
|
47
|
+
- Forward-port from `2.99.0`
|
|
35
48
|
|
|
36
49
|
## [3.19.0] - 2026-08-18
|
|
37
50
|
### Added
|
|
38
51
|
- Automatic sync of WordPress's bundled packages list
|
|
39
|
-
-
|
|
52
|
+
- Forward-port from `2.98.0`
|
|
40
53
|
|
|
41
54
|
## [3.18.0] - 2026-08-18
|
|
42
55
|
### Added
|
|
43
56
|
- David's improvements to build pipeline efficiency (Credit: David)
|
|
44
|
-
-
|
|
57
|
+
- Forward-port from `2.97.0`
|
|
45
58
|
- Support for David's `@plaudit/dev-webpack-plugin` (Credit: David)
|
|
46
|
-
-
|
|
59
|
+
- Forward-port from `2.97.0`
|
|
47
60
|
|
|
48
61
|
### Changed
|
|
49
62
|
- To Webpack's standard plugin interface (`WebpackPluginInstance`)
|
|
50
|
-
-
|
|
63
|
+
- Forward-port from `2.97.0`
|
|
51
64
|
|
|
52
65
|
### Removed
|
|
53
66
|
- Browsersync and its tests (Credit: David)
|
|
54
|
-
-
|
|
67
|
+
- Forward-port from `2.97.0`
|
|
55
68
|
|
|
56
69
|
## [3.17.0] - 2026-08-18
|
|
57
70
|
### Added
|
|
58
71
|
- A port of WordPress's Dependency Extraction Webpack Plugin because they keep breaking it
|
|
59
|
-
-
|
|
72
|
+
- Forward-port from `2.96.0`
|
|
60
73
|
- Warnings and additional info for entrypoints that are lazy-loaded and assigned to actual locations
|
|
61
|
-
-
|
|
74
|
+
- Forward-port from `2.96.0`
|
|
62
75
|
- An `externalize` that is not a string, an array, an object, or false is now rejected rather than silently ignored
|
|
63
76
|
- This matches with what webpack's `output.library` config supports
|
|
64
77
|
|
|
@@ -78,7 +91,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
78
91
|
|
|
79
92
|
### Removed
|
|
80
93
|
- `processTranslationConfigs` because it should not be used and didn't actually do anything
|
|
81
|
-
-
|
|
94
|
+
- Forward-port from `2.96.2`
|
|
82
95
|
|
|
83
96
|
### Internals
|
|
84
97
|
- Added more integration tests
|
|
@@ -87,9 +100,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
87
100
|
### Added
|
|
88
101
|
- Logic so that files and directories with names equal to "example" or "examples" or that include "example" as a name segment are skipped
|
|
89
102
|
- This is done to allow us to include example files
|
|
90
|
-
-
|
|
103
|
+
- Forward-port from `2.95.0`
|
|
91
104
|
- Updated the user guide with this information
|
|
92
|
-
-
|
|
105
|
+
- Forward-port from `2.95.0`
|
|
93
106
|
|
|
94
107
|
### Fixed
|
|
95
108
|
- The TOC in the user guide being out of date
|
|
@@ -97,25 +110,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
97
110
|
## [3.15.1] - 2026-07-20
|
|
98
111
|
### Fixed
|
|
99
112
|
- A bug that caused all styles bound for editor use to be emitted as inline CSS
|
|
100
|
-
-
|
|
113
|
+
- Forward-port from `2.94.1`
|
|
101
114
|
|
|
102
115
|
## [3.15.0] - 2026-07-17
|
|
103
116
|
### Changed
|
|
104
117
|
- The `add_editor_style()` enqueue path to use `block_editor_settings_all` to avoid a litany of bugs courtesy of WordPress's high-quality code
|
|
105
|
-
-
|
|
118
|
+
- Forward-port from `2.94.0`
|
|
106
119
|
|
|
107
120
|
## [3.14.1] - 2026-07-15
|
|
108
121
|
### Fixed
|
|
109
122
|
- The new supported features code overriding unintended data in theme.json
|
|
110
|
-
-
|
|
123
|
+
- Forward-port from `2.93.1`
|
|
111
124
|
|
|
112
125
|
## [3.14.0] - 2026-07-15
|
|
113
126
|
### Added
|
|
114
127
|
- Logic to emit code that makes the supported features declared in block.json file the defaults for those blocks in the "theme.json" file
|
|
115
128
|
- This uses filters to achieve the "defaulting", which means that it's plugin and theme agnostic
|
|
116
|
-
-
|
|
129
|
+
- Forward-port from `2.93.0`
|
|
117
130
|
- The `useBlockSupportsAsThemeJsonDefaults` flag to allow the new logic to be disabled
|
|
118
|
-
-
|
|
131
|
+
- Forward-port from `2.93.0`
|
|
119
132
|
|
|
120
133
|
## [3.13.0] - 2026-07-14
|
|
121
134
|
### Added
|
|
@@ -167,45 +180,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
167
180
|
## [3.9.4] - 2026-06-10
|
|
168
181
|
### Fixed
|
|
169
182
|
- Libraries externalizing in a way that does not account for the variable potentially being undeclared
|
|
170
|
-
-
|
|
183
|
+
- Forward-port from `2.92.4`
|
|
171
184
|
|
|
172
185
|
## [3.9.3] - 2026-05-27
|
|
173
186
|
### Fixed
|
|
174
187
|
- A couple more dependency snarls
|
|
175
|
-
-
|
|
188
|
+
- Forward-port from `2.92.3`
|
|
176
189
|
|
|
177
190
|
## [3.9.2] - 2026-05-26
|
|
178
191
|
### Fixed
|
|
179
192
|
- The `"supports-bindings": true` flag resulting in emission of invalid PHP code
|
|
180
|
-
-
|
|
193
|
+
- Forward-port from `2.92.2`
|
|
181
194
|
|
|
182
195
|
## [3.9.1] - 2026-05-21
|
|
183
196
|
### Fixed
|
|
184
197
|
- Compatibility issues with module-mode building
|
|
185
|
-
-
|
|
198
|
+
- Forward-port from `2.92.1`
|
|
186
199
|
- `module_dependencies` being set to `null` instead of being omitted
|
|
187
|
-
-
|
|
200
|
+
- Forward-port from `2.92.1`
|
|
188
201
|
|
|
189
202
|
## [3.9.0] - 2026-05-20
|
|
190
203
|
### Added
|
|
191
204
|
- Support for marking `block.json` attributes with `"supports-bindings": true` to enable block binding support in the editor
|
|
192
|
-
-
|
|
205
|
+
- Forward-port from `2.92.0`
|
|
193
206
|
|
|
194
207
|
## [3.8.0] - 2026-05-20
|
|
195
208
|
### Added
|
|
196
209
|
- Support for the `module_dependencies` property on `script` assets
|
|
197
|
-
-
|
|
210
|
+
- Forward-port from `2.91.0`
|
|
198
211
|
|
|
199
212
|
## [3.7.0] - 2026-05-04
|
|
200
213
|
### Added
|
|
201
214
|
- PNPM 11 compatibility
|
|
202
|
-
-
|
|
215
|
+
- Forward-port from `2.90.0`
|
|
203
216
|
|
|
204
217
|
## [3.6.3] - 2026-04-27
|
|
205
218
|
### Fixed
|
|
206
219
|
- An `ENOENT` error when the `srcDir` does not map to an actual directory on disk
|
|
207
220
|
- It now matches the behavior of manually-declared sources and exits due to not having anything to build
|
|
208
|
-
-
|
|
221
|
+
- Forward-port from `2.89.2`
|
|
209
222
|
|
|
210
223
|
## [3.6.2] - 2026-04-09
|
|
211
224
|
### Changed
|
|
@@ -214,44 +227,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
214
227
|
## [3.6.1] - 2026-04-06
|
|
215
228
|
### Fixed
|
|
216
229
|
- The emitter for the Extensions v1 format including an extra path element
|
|
217
|
-
-
|
|
230
|
+
- Forward-port from `2.89.1`
|
|
218
231
|
|
|
219
232
|
## [3.6.0] - 2026-03-31
|
|
220
233
|
### Changed
|
|
221
234
|
- The block.json handling logic to use encoded location data in filenames that are enumerated within block.json
|
|
222
|
-
-
|
|
235
|
+
- Forward-port from `2.89.0`
|
|
223
236
|
- Inline scripts to not emit with a sourcemap outside of dev mode
|
|
224
|
-
-
|
|
237
|
+
- Forward-port from `2.89.0`
|
|
225
238
|
|
|
226
239
|
### Fixed
|
|
227
240
|
- Unnecessary `.asset.php` files being emitted for inlined scripts
|
|
228
|
-
-
|
|
241
|
+
- Forward-port from `2.89.0`
|
|
229
242
|
|
|
230
243
|
## [3.5.2] - 2026-03-30
|
|
231
244
|
### Fixed
|
|
232
245
|
- The conflicting handle detection logic in block.json handling
|
|
233
|
-
-
|
|
246
|
+
- Forward-port from `2.88.2`
|
|
234
247
|
|
|
235
248
|
## [3.5.1] - 2026-03-30
|
|
236
249
|
### Fixed
|
|
237
250
|
- The paths in package.json that were broken after switching to dist
|
|
238
|
-
-
|
|
251
|
+
- Forward-port from `2.88.1`
|
|
239
252
|
|
|
240
253
|
## [3.5.0] - 2026-03-30
|
|
241
254
|
### Added
|
|
242
255
|
- Support for explicitly setting the handle for block assets
|
|
243
|
-
-
|
|
256
|
+
- Forward-port from `2.88.0`
|
|
244
257
|
|
|
245
258
|
## [3.4.1] - 2026-03-17
|
|
246
259
|
### Changed
|
|
247
260
|
- The `blockdir-loader.php` generation logic to use static wp_register_* calls like `plain-entrypoints-loader.php`
|
|
248
|
-
-
|
|
261
|
+
- Forward-port from `2.87.1`
|
|
249
262
|
|
|
250
263
|
## [3.4.0] - 2026-03-16
|
|
251
264
|
### Added
|
|
252
265
|
- Support for a directory-based `extensions` layout
|
|
253
266
|
- This only applies to sites using extensions v2 and higher
|
|
254
|
-
-
|
|
267
|
+
- Forward-port from `2.87.0`
|
|
255
268
|
|
|
256
269
|
## [3.3.0] - 2026-03-16
|
|
257
270
|
### Added
|
|
@@ -268,25 +281,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
268
281
|
## [3.2.0] - 2026-03-16
|
|
269
282
|
### Added
|
|
270
283
|
- Support for `Location-Encoding Filenames`
|
|
271
|
-
-
|
|
284
|
+
- Forward-port from `2.86.0`
|
|
272
285
|
- Support for standardized flag sets
|
|
273
|
-
-
|
|
286
|
+
- Forward-port from `2.86.0`
|
|
274
287
|
|
|
275
288
|
## [3.1.2] - 2026-03-06
|
|
276
289
|
### Fixed
|
|
277
290
|
- `defer` and `async` not being supported strategies in some pipelines
|
|
278
|
-
-
|
|
291
|
+
- Forward-port from `2.85.3`
|
|
279
292
|
|
|
280
293
|
## [3.1.1] - 2026-03-06
|
|
281
294
|
### Fixed
|
|
282
295
|
- Inlined scripts without any other path query parameters not being placed in the footer by default
|
|
283
|
-
-
|
|
296
|
+
- Forward-port from `2.85.2`
|
|
284
297
|
|
|
285
298
|
## [3.1.0] - 2026-03-05
|
|
286
299
|
### Added
|
|
287
300
|
- Support for inlining (and otherwise controlling the enqueuing of) assets
|
|
288
301
|
- This only applies to plain entrypoints and assets declared within block.json files at present
|
|
289
|
-
-
|
|
302
|
+
- Forward-port from `2.85.0`
|
|
290
303
|
|
|
291
304
|
## [3.0.1] - 2026-02-12
|
|
292
305
|
### Added
|
|
@@ -308,6 +321,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
308
321
|
- Legacy PostCSS features that have been integrated into modern CSS
|
|
309
322
|
- `@extends` support
|
|
310
323
|
|
|
324
|
+
## [2.99.3] - 2026-09-04
|
|
325
|
+
### Fixed
|
|
326
|
+
- The `inline` flag not getting picked up if it was set from within the webpack.config.js file
|
|
327
|
+
- Inlined assets getting put in the registered assets list
|
|
328
|
+
- An unnecessary call to `plaudit_webpack_extensions__resolve_base_uri` being emitted when a "registration" batch exclusively contains inlined assets
|
|
329
|
+
|
|
330
|
+
### Internals
|
|
331
|
+
- Tweaked a few things to make adding new enqueue locations easier
|
|
332
|
+
|
|
311
333
|
## [2.99.2] - 2026-09-01
|
|
312
334
|
### Removed
|
|
313
335
|
- The duplicated `isDistDevOutputPath` logic around the initialization of the `@plaudit/dev-webpack-plugin`
|
|
@@ -46,35 +46,29 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
46
46
|
}
|
|
47
47
|
const file = new php_writer_1.PHPFile();
|
|
48
48
|
const writer = file.getWriter("");
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
const hasRegisterScripts = handleLists.register.length > 0;
|
|
50
|
+
if (hasRegisterScripts || handleLists.inline.length > 0) {
|
|
51
|
+
if (hasRegisterScripts && !this.useUnifiedLoader) {
|
|
51
52
|
(0, shared_1.emitResolveBaseUriFunction)(writer);
|
|
52
53
|
}
|
|
53
54
|
const baseUriVar = new expressions_1.Var("base_uri");
|
|
54
|
-
|
|
55
|
+
const inlineAndRegisterHandleLists = [...handleLists.register, ...handleLists.inline];
|
|
56
|
+
for (const [priority, prioritizedHandleList] of PlainEntrypointsConfigFileGeneratorPlugin.separateHandleListByPriority(inlineAndRegisterHandleLists)) {
|
|
55
57
|
writer.action("init", writer => {
|
|
56
|
-
|
|
58
|
+
const state = { baseUriVar, emitDir, writer };
|
|
59
|
+
if (prioritizedHandleList.find(handleItem => handleItem.data.inlinedAsset === undefined)) {
|
|
60
|
+
writer.call("plaudit_webpack_extensions__resolve_base_uri", [expressions_1.Constants.__DIR__], { assignTo: baseUriVar });
|
|
61
|
+
}
|
|
57
62
|
for (const handleItem of prioritizedHandleList) {
|
|
58
|
-
PlainEntrypointsConfigFileGeneratorPlugin.writeHandleItem(compilation, handleItem,
|
|
63
|
+
PlainEntrypointsConfigFileGeneratorPlugin.writeHandleItem(compilation, handleItem, state);
|
|
59
64
|
if (handleItem.data.associatedInlinedHandles !== undefined) {
|
|
60
65
|
for (const associatedHandle of handleItem.data.associatedInlinedHandles) {
|
|
61
|
-
PlainEntrypointsConfigFileGeneratorPlugin.writeHandleItem(compilation, { data: associatedHandle, handle: handleItem.handle, type: associatedHandle.type },
|
|
66
|
+
PlainEntrypointsConfigFileGeneratorPlugin.writeHandleItem(compilation, { data: associatedHandle, handle: handleItem.handle, type: associatedHandle.type }, state);
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
}, { priority, accountForAlreadyDoing: this.config.includePostInitFallback });
|
|
66
71
|
}
|
|
67
|
-
for (const [priority, prioritizedHandleList] of PlainEntrypointsConfigFileGeneratorPlugin.separateHandleListByPriority(handleLists.inline)) {
|
|
68
|
-
writer.action("init", writer => {
|
|
69
|
-
writer.call("plaudit_webpack_extensions__resolve_base_uri", [expressions_1.Constants.__DIR__], { assignTo: baseUriVar });
|
|
70
|
-
for (const { handle, type, data } of prioritizedHandleList) {
|
|
71
|
-
writer.call(`wp_register_${type}`, [handle, false, ...data.rest]);
|
|
72
|
-
if (data.inlinedAsset !== undefined) {
|
|
73
|
-
(0, shared_1.appendAddInlineAssetCall)(compilation, writer, handle, type, data);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}, { priority, accountForAlreadyDoing: this.config.includePostInitFallback });
|
|
77
|
-
}
|
|
78
72
|
}
|
|
79
73
|
PlainEntrypointsConfigFileGeneratorPlugin.appendEnqueuingHandleLists(writer, handleLists);
|
|
80
74
|
const sortedEditorStyleHandles = sortedStyleHandles
|
|
@@ -196,12 +190,12 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
196
190
|
static addHandlesToHandleLists(compilation, type, handles, handleLists) {
|
|
197
191
|
const defaultPriority = 10;
|
|
198
192
|
for (const [handle, data] of handles) {
|
|
199
|
-
if (data.
|
|
200
|
-
handleLists.register.push({ handle, type, data, priority: typeof data.locations.register === 'number' ? data.locations.register : 10 });
|
|
201
|
-
}
|
|
202
|
-
else if (data.inlinedAsset !== undefined) {
|
|
193
|
+
if (data.inlinedAsset !== undefined) {
|
|
203
194
|
handleLists.inline.push({ handle, type, data, priority: typeof data.locations.inline === 'number' ? data.locations.inline : 10 });
|
|
204
195
|
}
|
|
196
|
+
else if (data.locations.register !== false) {
|
|
197
|
+
handleLists.register.push({ handle, type, data, priority: typeof data.locations.register === 'number' ? data.locations.register : 10 });
|
|
198
|
+
}
|
|
205
199
|
if (data.lazyLoader !== undefined) {
|
|
206
200
|
// A lazily loaded handle is enqueued by its generated function and never by an action, so it
|
|
207
201
|
// is deliberately kept out of the location lists. Those lists are also what the lazy function
|
|
@@ -258,7 +252,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
258
252
|
}
|
|
259
253
|
}
|
|
260
254
|
static appendEnqueuingHandleLists(writer, handleLists) {
|
|
261
|
-
for (const [sln, { action, supports_hook_name, additional_action_code }] of (0, shared_1.
|
|
255
|
+
for (const [sln, { action, supports_hook_name, additional_action_code }] of (0, shared_1.iterableStandardLocationNamesMeta)()) {
|
|
262
256
|
const handleList = handleLists[sln];
|
|
263
257
|
if (handleList.length > 0) {
|
|
264
258
|
writer.linebreak();
|
|
@@ -269,7 +263,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
269
263
|
const hook_name_var = new expressions_1.Var("hook_name", "?string");
|
|
270
264
|
writer.action(action, writer => {
|
|
271
265
|
additional_action_code?.before?.(writer);
|
|
272
|
-
if (hookNamedHandleLists.global) {
|
|
266
|
+
if (hookNamedHandleLists.global.length > 0) {
|
|
273
267
|
for (const handle of hookNamedHandleLists.global) {
|
|
274
268
|
writer.call(`wp_enqueue_${handle.type}`, [handle.handle]);
|
|
275
269
|
}
|
|
@@ -370,7 +364,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
370
364
|
const { dependencies = [], module_dependencies = undefined } = isScript === entrypointChunkIsScript ? assetData : {};
|
|
371
365
|
const { lazyLoader, locations } = this.dest;
|
|
372
366
|
const { flags } = (0, path_query_and_related_helpers_1.unpackEnqueuingControlFlagsFromPathQueryParameters)(typeof locations.registerScriptArgs === 'object' ? locations.registerScriptArgs : { strategy: locations.registerScriptArgs }, file, "registerScriptArgs");
|
|
373
|
-
const { assetMeta, scriptArgsObject } = (0, path_query_and_related_helpers_1.convertEnqueuingControlFlagsToScriptArgsObject)(compilation, file, (0, path_query_and_related_helpers_1.mergeTwoEnqueuingControlFlagSets)(file, flags, this.dest.enqueuingFlags), type === 'style' && (!!locations.clientEditor || locations.clientEditor === 0));
|
|
367
|
+
const { assetMeta, scriptArgsObject } = (0, path_query_and_related_helpers_1.convertEnqueuingControlFlagsToScriptArgsObject)(compilation, file, (0, path_query_and_related_helpers_1.mergeTwoEnqueuingControlFlagSets)(file, flags, this.dest.enqueuingFlags, this.dest.locations.inline !== undefined ? { inline: true } : undefined), type === 'style' && (!!locations.clientEditor || locations.clientEditor === 0));
|
|
374
368
|
const completeScriptArgsObject = module_dependencies?.length ? { ...scriptArgsObject, module_dependencies } : scriptArgsObject;
|
|
375
369
|
const rest = isScript && completeScriptArgsObject !== undefined ? [dependencies, assetData.version, completeScriptArgsObject] : [dependencies, assetData.version];
|
|
376
370
|
const destPath = (0, node_path_1.join)(compilation.outputOptions.path, file);
|
package/dist/shared.d.ts
CHANGED
|
@@ -42,15 +42,26 @@ export type HandleData = BaseHandleData & (AssetMetaSegment | {
|
|
|
42
42
|
inlinedAsset?: undefined;
|
|
43
43
|
assetContents?: string;
|
|
44
44
|
});
|
|
45
|
+
type OptionalLocationMeta = {
|
|
46
|
+
supports_hook_name?: boolean;
|
|
47
|
+
additional_action_code?: {
|
|
48
|
+
before?(writer: PHPWriter): unknown;
|
|
49
|
+
after?(writer: PHPWriter): unknown;
|
|
50
|
+
};
|
|
51
|
+
alternate_names?: [string, ...string[]];
|
|
52
|
+
};
|
|
45
53
|
export declare const standardLocationNamesMeta: {
|
|
46
54
|
readonly clientView: {
|
|
47
55
|
readonly action: "wp_enqueue_scripts";
|
|
56
|
+
readonly alternate_names: ["client-view", "view"];
|
|
48
57
|
};
|
|
49
58
|
readonly clientEditor: {
|
|
50
59
|
readonly action: "enqueue_block_editor_assets";
|
|
60
|
+
readonly alternate_names: ["client-editor", "editor"];
|
|
51
61
|
};
|
|
52
62
|
readonly blockAssets: {
|
|
53
63
|
readonly action: "enqueue_block_assets";
|
|
64
|
+
readonly alternate_names: ["block-assets"];
|
|
54
65
|
};
|
|
55
66
|
readonly admin: {
|
|
56
67
|
readonly action: "admin_enqueue_scripts";
|
|
@@ -68,14 +79,11 @@ export declare const standardLocationNamesMeta: {
|
|
|
68
79
|
};
|
|
69
80
|
export type StandardLocationNameMeta = {
|
|
70
81
|
action: typeof standardLocationNamesMeta[keyof typeof standardLocationNamesMeta]['action'];
|
|
71
|
-
|
|
72
|
-
additional_action_code?: {
|
|
73
|
-
before?(writer: PHPWriter): unknown;
|
|
74
|
-
after?(writer: PHPWriter): unknown;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
82
|
+
} & OptionalLocationMeta;
|
|
77
83
|
export type StandardLocationNames = keyof typeof standardLocationNamesMeta;
|
|
78
84
|
export declare function isStandardLocationName(name: string): name is StandardLocationNames;
|
|
85
|
+
export declare function iterableStandardLocationNamesMeta(): [StandardLocationNames, StandardLocationNameMeta][];
|
|
86
|
+
export declare function normalizeLocationName(name: string): StandardLocationNames | 'register';
|
|
79
87
|
type LocationWithHookNameSupport = boolean | number | string | string[] | {
|
|
80
88
|
hook_name?: string | string[];
|
|
81
89
|
priority?: number;
|
package/dist/shared.js
CHANGED
|
@@ -20,6 +20,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.styleExtension = exports.scriptWithModuleExtension = exports.scriptWithoutModuleExtension = exports.scriptExtension = exports.entrypointFields = exports.standardLocationNamesMeta = void 0;
|
|
21
21
|
exports.isParsedAssetsJson = isParsedAssetsJson;
|
|
22
22
|
exports.isStandardLocationName = isStandardLocationName;
|
|
23
|
+
exports.iterableStandardLocationNamesMeta = iterableStandardLocationNamesMeta;
|
|
24
|
+
exports.normalizeLocationName = normalizeLocationName;
|
|
23
25
|
exports.isRegisterScriptArgsShorthandName = isRegisterScriptArgsShorthandName;
|
|
24
26
|
exports.isNormalizedUsageLocations = isNormalizedUsageLocations;
|
|
25
27
|
exports.convertHookLocationToNamesAndPriority = convertHookLocationToNamesAndPriority;
|
|
@@ -79,9 +81,9 @@ function isParsedAssetsJson(thing) {
|
|
|
79
81
|
return true;
|
|
80
82
|
}
|
|
81
83
|
exports.standardLocationNamesMeta = {
|
|
82
|
-
clientView: { action: "wp_enqueue_scripts" },
|
|
83
|
-
clientEditor: { action: "enqueue_block_editor_assets" },
|
|
84
|
-
blockAssets: { action: "enqueue_block_assets" },
|
|
84
|
+
clientView: { action: "wp_enqueue_scripts", alternate_names: ['client-view', 'view'] },
|
|
85
|
+
clientEditor: { action: "enqueue_block_editor_assets", alternate_names: ['client-editor', 'editor'] },
|
|
86
|
+
blockAssets: { action: "enqueue_block_assets", alternate_names: ['block-assets'] },
|
|
85
87
|
admin: { action: "admin_enqueue_scripts", supports_hook_name: true },
|
|
86
88
|
login: { action: "login_enqueue_scripts" },
|
|
87
89
|
customizer: { action: "customize_controls_enqueue_scripts" },
|
|
@@ -90,6 +92,20 @@ exports.standardLocationNamesMeta = {
|
|
|
90
92
|
function isStandardLocationName(name) {
|
|
91
93
|
return Object.hasOwn(exports.standardLocationNamesMeta, name);
|
|
92
94
|
}
|
|
95
|
+
function iterableStandardLocationNamesMeta() {
|
|
96
|
+
return constantEntries(exports.standardLocationNamesMeta);
|
|
97
|
+
}
|
|
98
|
+
function normalizeLocationName(name) {
|
|
99
|
+
if (isStandardLocationName(name) || name === 'register') {
|
|
100
|
+
return name;
|
|
101
|
+
}
|
|
102
|
+
for (const [standardName, { alternate_names }] of iterableStandardLocationNamesMeta()) {
|
|
103
|
+
if (alternate_names?.includes(name)) {
|
|
104
|
+
return standardName;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
throw new Error(`"${name}" is neither a standard nor alternate location name`);
|
|
108
|
+
}
|
|
93
109
|
function isRegisterScriptArgsShorthandName(name) {
|
|
94
110
|
return ['lazy', 'eager', 'inline'].includes(name);
|
|
95
111
|
}
|
|
@@ -17,14 +17,14 @@ export declare function parseLocationEncodingFilenameForBlock(filename: string,
|
|
|
17
17
|
handle: ParsedLocationEncodingFilename['locations']['handle'];
|
|
18
18
|
}) | undefined;
|
|
19
19
|
/**
|
|
20
|
-
* This handles detecting all keys of standardLocationNamesMeta as well as
|
|
20
|
+
* This handles detecting all keys of standardLocationNamesMeta as well as the values listed in their associated alternate_names properties
|
|
21
21
|
* It MUST be kept in sync with standardLocationNamesMeta
|
|
22
22
|
* @param segment
|
|
23
23
|
*/
|
|
24
24
|
export declare function extractLocationFromPropertyEncodingFilenameSegment(segment: string): {
|
|
25
|
+
readonly locationName: false;
|
|
26
|
+
readonly priority?: undefined;
|
|
27
|
+
} | {
|
|
25
28
|
readonly locationName: "admin" | "analytics" | "blockAssets" | "clientEditor" | "clientView" | "customizer" | "login" | "register";
|
|
26
29
|
readonly priority: number | true;
|
|
27
|
-
} | {
|
|
28
|
-
readonly priority?: undefined;
|
|
29
|
-
readonly locationName: false;
|
|
30
30
|
};
|
|
@@ -98,27 +98,23 @@ function parseLocationEncodingFilenameForBlock(filename, errorBuilder = shared_1
|
|
|
98
98
|
}
|
|
99
99
|
return parsedFilename;
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
let standardLocationNamesAndPriorityPatternInFilenameSegment;
|
|
102
102
|
/**
|
|
103
|
-
* This handles detecting all keys of standardLocationNamesMeta as well as
|
|
103
|
+
* This handles detecting all keys of standardLocationNamesMeta as well as the values listed in their associated alternate_names properties
|
|
104
104
|
* It MUST be kept in sync with standardLocationNamesMeta
|
|
105
105
|
* @param segment
|
|
106
106
|
*/
|
|
107
107
|
function extractLocationFromPropertyEncodingFilenameSegment(segment) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
if (editor) {
|
|
115
|
-
return { locationName: "clientEditor", priority };
|
|
108
|
+
if (!standardLocationNamesAndPriorityPatternInFilenameSegment) {
|
|
109
|
+
const matchableLocationNames = (0, shared_1.iterableStandardLocationNamesMeta)()
|
|
110
|
+
.flatMap(([standardName, { alternate_names = [] }]) => [standardName, ...alternate_names])
|
|
111
|
+
.join("|");
|
|
112
|
+
standardLocationNamesAndPriorityPatternInFilenameSegment = new RegExp(`^(?<locationName>${matchableLocationNames}|register)(?:[-=](?<priority>-?\\d+))?$`);
|
|
116
113
|
}
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
const { locationName, priority: rawPriority } = standardLocationNamesAndPriorityPatternInFilenameSegment.exec(segment)?.groups ?? {};
|
|
115
|
+
if (!locationName) {
|
|
116
|
+
return { locationName: false };
|
|
119
117
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
return { locationName: false };
|
|
118
|
+
const priority = rawPriority !== undefined ? parseInt(rawPriority) : true;
|
|
119
|
+
return { locationName: (0, shared_1.normalizeLocationName)(locationName), priority };
|
|
124
120
|
}
|
|
@@ -12,11 +12,15 @@ const BUNDLED_PACKAGES = [
|
|
|
12
12
|
'@wordpress/dataviews',
|
|
13
13
|
'@wordpress/dataviews/wp',
|
|
14
14
|
'@wordpress/fields',
|
|
15
|
+
'@wordpress/global-styles-engine',
|
|
16
|
+
'@wordpress/global-styles-ui',
|
|
15
17
|
'@wordpress/grid',
|
|
16
18
|
'@wordpress/icons',
|
|
17
19
|
'@wordpress/interface',
|
|
18
20
|
'@wordpress/kebab-case',
|
|
21
|
+
'@wordpress/react-inert-value',
|
|
19
22
|
'@wordpress/style-runtime',
|
|
23
|
+
'@wordpress/sync',
|
|
20
24
|
'@wordpress/ui',
|
|
21
25
|
'@wordpress/undo-manager',
|
|
22
26
|
'@wordpress/views',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "3.21.
|
|
3
|
+
"version": "3.21.2",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,42 +34,41 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@plaudit/dev-webpack-plugin": "^1.
|
|
38
|
-
"@plaudit/gutenberg-api-extensions": "^2.
|
|
37
|
+
"@plaudit/dev-webpack-plugin": "^1.5.0",
|
|
38
|
+
"@plaudit/gutenberg-api-extensions": "^2.101.1",
|
|
39
39
|
"@types/jsdom": "^30.0.0",
|
|
40
|
-
"@types/node": "^26.
|
|
40
|
+
"@types/node": "^26.6.5",
|
|
41
41
|
"@types/postcss-functions": "^4.0.4",
|
|
42
42
|
"@types/postcss-import": "^14.0.3",
|
|
43
43
|
"@types/tapable": "^2.3.0",
|
|
44
44
|
"@types/webpack-sources": "^3.2.3",
|
|
45
|
-
"@wordpress/dependency-extraction-webpack-plugin": "^6.
|
|
45
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^6.57.0",
|
|
46
46
|
"atob": "^2.1.2",
|
|
47
47
|
"css-loader": "^6.11.0",
|
|
48
|
-
"
|
|
49
|
-
"jest": "^30.4.2",
|
|
48
|
+
"jest": "^30.5.2",
|
|
50
49
|
"lodash": "^4.18.1",
|
|
51
50
|
"mini-css-extract-plugin": "^2.10.2",
|
|
52
51
|
"mkdirp": "^3.0.1",
|
|
53
|
-
"react": "^
|
|
54
|
-
"react-dom": "^
|
|
55
|
-
"rimraf": "^
|
|
52
|
+
"react": "^19.3.1",
|
|
53
|
+
"react-dom": "^19.3.1",
|
|
54
|
+
"rimraf": "^6.1.3",
|
|
56
55
|
"typescript": "^7.0.2",
|
|
57
|
-
"webpack-bundle-analyzer": "^5.
|
|
56
|
+
"webpack-bundle-analyzer": "^5.4.0"
|
|
58
57
|
},
|
|
59
58
|
"dependencies": {
|
|
60
|
-
"@plaudit/php-writer": "^1.
|
|
59
|
+
"@plaudit/php-writer": "^1.11.0",
|
|
61
60
|
"@plaudit/postcss-color-function": "^5.1.0",
|
|
62
61
|
"@plaudit/postcss-strip-units": "^3.0.0",
|
|
63
62
|
"@plaudit/postcss-variables": "^2.0.1",
|
|
64
|
-
"@wordpress/scripts": "^
|
|
65
|
-
"autoprefixer": "^10.
|
|
63
|
+
"@wordpress/scripts": "^36.1.0",
|
|
64
|
+
"autoprefixer": "^10.6.1",
|
|
66
65
|
"copy-webpack-plugin": "10.2.4",
|
|
67
66
|
"css-minimizer-webpack-plugin": "^8.0.0",
|
|
68
67
|
"cssnano": "^7.1.9",
|
|
69
68
|
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
|
70
|
-
"jsdom": "^30.
|
|
69
|
+
"jsdom": "^30.1.2",
|
|
71
70
|
"json2php": "0.0.12",
|
|
72
|
-
"postcss": "^8.5.
|
|
71
|
+
"postcss": "^8.5.30",
|
|
73
72
|
"postcss-calc": "^10.1.1",
|
|
74
73
|
"postcss-functions": "^4.0.2",
|
|
75
74
|
"postcss-import": "^16.2.0",
|
|
@@ -79,7 +78,7 @@
|
|
|
79
78
|
"postcss-property-lookup": "^3.0.0",
|
|
80
79
|
"postcss-reporter": "^7.1.0",
|
|
81
80
|
"postcss-url": "^10.1.4",
|
|
82
|
-
"webpack": "^5.
|
|
81
|
+
"webpack": "^5.111.1",
|
|
83
82
|
"webpack-remove-empty-scripts": "^1.1.1",
|
|
84
83
|
"xml-formatter": "^3.7.0"
|
|
85
84
|
},
|