@plaudit/webpack-extensions 2.89.2 → 3.0.0-rc.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 +0 -106
- package/USER-GUIDE.md +81 -117
- package/{dist → build}/plugins/EnhancedBlockJSONPlugin.d.ts +4 -7
- package/{dist → build}/plugins/EnhancedBlockJSONPlugin.js +53 -116
- package/{dist → build}/plugins/ExtensionsConfigFileGeneratorPlugin.d.ts +3 -7
- package/{dist → build}/plugins/ExtensionsConfigFileGeneratorPlugin.js +10 -74
- package/{dist → build}/plugins/ExtensionsConfigFileGeneratorPluginV1.d.ts +1 -1
- package/{dist → build}/plugins/ExtensionsConfigFileGeneratorPluginV1.js +0 -4
- package/{dist → build}/plugins/PlainEntrypointsConfigFileGeneratorPlugin.js +20 -46
- package/{dist → build}/plugins/UnifiedLoaderGenerator.d.ts +2 -1
- package/build/plugins/static-configs.d.ts +3 -0
- package/build/plugins/static-configs.js +33 -0
- package/{dist → build}/shared.d.ts +18 -86
- package/{dist → build}/shared.js +11 -124
- package/{dist → build}/utils/common-config-helpers.d.ts +1 -1
- package/{dist → build}/utils/common-config-helpers.js +49 -126
- package/{dist → build}/wordpress-scripts-wrapper.js +36 -70
- package/package.json +26 -35
- package/dist/plugins/static-configs.d.ts +0 -3
- package/dist/plugins/static-configs.js +0 -91
- package/dist/utils/entrypoint-resolution-logic.d.ts +0 -10
- package/dist/utils/entrypoint-resolution-logic.js +0 -82
- package/dist/utils/location-encoding-filename-parser.d.ts +0 -26
- package/dist/utils/location-encoding-filename-parser.js +0 -118
- package/dist/utils/path-query-and-related-helpers.d.ts +0 -58
- package/dist/utils/path-query-and-related-helpers.js +0 -263
- /package/{dist → build}/plugins/AbstractBiPhasicGroupAndEntryPlugin.d.ts +0 -0
- /package/{dist → build}/plugins/AbstractBiPhasicGroupAndEntryPlugin.js +0 -0
- /package/{dist → build}/plugins/AbstractBiPhasicGroupPlugin.d.ts +0 -0
- /package/{dist → build}/plugins/AbstractBiPhasicGroupPlugin.js +0 -0
- /package/{dist → build}/plugins/AdditionalDependencyInjectorPlugin.d.ts +0 -0
- /package/{dist → build}/plugins/AdditionalDependencyInjectorPlugin.js +0 -0
- /package/{dist → build}/plugins/BrowserSyncPlugin.d.ts +0 -0
- /package/{dist → build}/plugins/BrowserSyncPlugin.js +0 -0
- /package/{dist → build}/plugins/EnhancedDynamicEntryPlugin.d.ts +0 -0
- /package/{dist → build}/plugins/EnhancedDynamicEntryPlugin.js +0 -0
- /package/{dist → build}/plugins/MiniCSSExtractPluginErrorCleaner.d.ts +0 -0
- /package/{dist → build}/plugins/MiniCSSExtractPluginErrorCleaner.js +0 -0
- /package/{dist → build}/plugins/PackageConfigSanityChecker.d.ts +0 -0
- /package/{dist → build}/plugins/PackageConfigSanityChecker.js +0 -0
- /package/{dist → build}/plugins/PlainEntrypointsConfigFileGeneratorPlugin.d.ts +0 -0
- /package/{dist → build}/plugins/SpecialAssetHandlingPlugin.d.ts +0 -0
- /package/{dist → build}/plugins/SpecialAssetHandlingPlugin.js +0 -0
- /package/{dist → build}/plugins/UnifiedLoaderGenerator.js +0 -0
- /package/{dist → build}/plugins/VariablesJSMonitorPlugin.d.ts +0 -0
- /package/{dist → build}/plugins/VariablesJSMonitorPlugin.js +0 -0
- /package/{dist → build}/plugins/WPMLConfigBuilder.d.ts +0 -0
- /package/{dist → build}/plugins/WPMLConfigBuilder.js +0 -0
- /package/{dist → build}/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts +0 -0
- /package/{dist → build}/plugins/dependency-extraction-webpack-plugin-config-builder.js +0 -0
- /package/{dist → build}/utils/css-writer.d.ts +0 -0
- /package/{dist → build}/utils/css-writer.js +0 -0
- /package/{dist → build}/utils/pseduo-semaphore.d.ts +0 -0
- /package/{dist → build}/utils/pseduo-semaphore.js +0 -0
- /package/{dist → build}/wordpress-scripts-wrapper.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,49 +5,6 @@ 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.3.0] - 2026-03-16
|
|
9
|
-
### Added
|
|
10
|
-
- A few helper methods for tools that reference this package and care about the entrypoint resolution logic
|
|
11
|
-
|
|
12
|
-
## [3.2.2] - 2026-03-16
|
|
13
|
-
### Changed
|
|
14
|
-
- Exposed additional aspects of the entrypoint resolution logic to tools that reference this package
|
|
15
|
-
|
|
16
|
-
## [3.2.1] - 2026-03-16
|
|
17
|
-
### Added
|
|
18
|
-
- A function to expose standard flag sets to tools that reference this package
|
|
19
|
-
|
|
20
|
-
## [3.2.0] - 2026-03-16
|
|
21
|
-
### Added
|
|
22
|
-
- Support for `Location-Encoding Filenames`
|
|
23
|
-
- This comes from version `2.86.0`
|
|
24
|
-
- Support for standardized flag sets
|
|
25
|
-
- This comes from version `2.86.0`
|
|
26
|
-
|
|
27
|
-
## [3.1.2] - 2026-03-06
|
|
28
|
-
### Fixed
|
|
29
|
-
- `defer` and `async` not being supported strategies in some pipelines
|
|
30
|
-
- This comes from version `2.85.3`
|
|
31
|
-
|
|
32
|
-
## [3.1.1] - 2026-03-06
|
|
33
|
-
### Fixed
|
|
34
|
-
- Inlined scripts without any other path query parameters not being placed in the footer by default
|
|
35
|
-
- This comes from version `2.85.2`
|
|
36
|
-
|
|
37
|
-
## [3.1.0] - 2026-03-05
|
|
38
|
-
### Added
|
|
39
|
-
- Support for inlining (and otherwise controlling the enqueuing of) assets
|
|
40
|
-
- This only applies to plain entrypoints and assets declared within block.json files at present
|
|
41
|
-
- This comes from version `2.85.0`
|
|
42
|
-
|
|
43
|
-
## [3.0.1] - 2026-02-12
|
|
44
|
-
### Added
|
|
45
|
-
- Release version!
|
|
46
|
-
|
|
47
|
-
## [3.0.0-rc.3] - 2026-02-12
|
|
48
|
-
### Fixed
|
|
49
|
-
- A missing dependency
|
|
50
|
-
|
|
51
8
|
## [3.0.0-rc.2] - 2026-02-12
|
|
52
9
|
### Fixed
|
|
53
10
|
- A missing dependency
|
|
@@ -60,69 +17,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
60
17
|
- Legacy PostCSS features that have been integrated into modern CSS
|
|
61
18
|
- `@extends` support
|
|
62
19
|
|
|
63
|
-
## [2.89.2] - 2026-04-27
|
|
64
|
-
### Fixed
|
|
65
|
-
- An `ENOENT` error when the `srcDir` does not map to an actual directory on disk
|
|
66
|
-
- It now matches the behavior of manually-declared sources and exits due to not having anything to build
|
|
67
|
-
|
|
68
|
-
## [2.89.1] - 2026-04-06
|
|
69
|
-
### Fixed
|
|
70
|
-
- The emitter for the Extensions v1 format including an extra path element
|
|
71
|
-
|
|
72
|
-
## [2.89.0] - 2026-03-31
|
|
73
|
-
### Changed
|
|
74
|
-
- The block.json handling logic to use encoded location data in filenames that are enumerated within block.json
|
|
75
|
-
- Inline scripts to not emit with a sourcemap outside of dev mode
|
|
76
|
-
|
|
77
|
-
### Fixed
|
|
78
|
-
- Unnecessary `.asset.php` files being emitted for inlined scripts
|
|
79
|
-
|
|
80
|
-
## [2.88.2] - 2026-03-30
|
|
81
|
-
### Fixed
|
|
82
|
-
- The conflicting handle detection logic in block.json handling
|
|
83
|
-
|
|
84
|
-
## [2.88.1] - 2026-03-30
|
|
85
|
-
### Fixed
|
|
86
|
-
- The paths in package.json that were broken after switching to dist
|
|
87
|
-
|
|
88
|
-
## [2.88.0] - 2026-03-30
|
|
89
|
-
### Added
|
|
90
|
-
- Support for explicitly setting the handle for block assets
|
|
91
|
-
|
|
92
|
-
## [2.87.1] - 2026-03-17
|
|
93
|
-
### Changed
|
|
94
|
-
- The `blockdir-loader.php` generation logic to use static wp_register_* calls like `plain-entrypoints-loader.php`
|
|
95
|
-
|
|
96
|
-
## [2.87.0] - 2026-03-16
|
|
97
|
-
### Added
|
|
98
|
-
- Support for a directory-based `extensions` layout
|
|
99
|
-
- This only applies to sites using extensions v2 and higher
|
|
100
|
-
|
|
101
|
-
### Internals
|
|
102
|
-
- Backported the features from `3.2.x` and `3.3.0`
|
|
103
|
-
|
|
104
|
-
## [2.86.0] - 2026-03-16
|
|
105
|
-
### Added
|
|
106
|
-
- Support for `Location-Encoding Filenames`
|
|
107
|
-
- Support for standardized flag sets
|
|
108
|
-
|
|
109
|
-
## [2.85.3] - 2026-03-06
|
|
110
|
-
### Fixed
|
|
111
|
-
- `defer` and `async` not being supported strategies in some pipelines
|
|
112
|
-
|
|
113
|
-
## [2.85.2] - 2026-03-06
|
|
114
|
-
### Fixed
|
|
115
|
-
- Issues caused by trying to save a couple of cycles by using `hasAnyKeys` in place of checking the actual keys
|
|
116
|
-
|
|
117
|
-
## [2.85.1] - 2026-03-06
|
|
118
|
-
### Fixed
|
|
119
|
-
- Inlined scripts without any other path query parameters not being placed in the footer by default
|
|
120
|
-
|
|
121
|
-
## [2.85.0] - 2026-03-05
|
|
122
|
-
### Added
|
|
123
|
-
- Support for inlining (and otherwise controlling the enqueuing of) assets
|
|
124
|
-
- This only applies to plain entrypoints and assets declared within block.json files at present
|
|
125
|
-
|
|
126
20
|
## [2.84.1] - 2026-02-11
|
|
127
21
|
### Fixed
|
|
128
22
|
- Typedef compatibility issues with Webpack 5.105.0
|
package/USER-GUIDE.md
CHANGED
|
@@ -28,13 +28,7 @@
|
|
|
28
28
|
* [Pattern 4: Block Editor Styles](#pattern-4-block-editor-styles)
|
|
29
29
|
* [Reference](#reference)
|
|
30
30
|
* [Root Options](#root-options)
|
|
31
|
-
* [Standard Flag Sets](#standard-flag-sets)
|
|
32
|
-
* [Location-Encoding Filenames](#location-encoding-filenames)
|
|
33
|
-
* [Enqueuing Location](#enqueuing-location)
|
|
34
|
-
* [Examples](#examples-1)
|
|
35
|
-
* [Block- and Plain-compatible](#block--and-plain-compatible)
|
|
36
31
|
* [Per-Entrypoint Options](#per-entrypoint-options)
|
|
37
|
-
* [Path Queries](#path-queries)
|
|
38
32
|
* [Boolean-form](#boolean-form)
|
|
39
33
|
* [String-form](#string-form)
|
|
40
34
|
* [Object-form](#object-form)
|
|
@@ -143,26 +137,81 @@ The config tells webpack **what** to build and **where** to load it in WordPress
|
|
|
143
137
|
|
|
144
138
|
```javascript
|
|
145
139
|
module.exports = require("@plaudit/webpack-extensions/wordpress-scripts-wrapper")({
|
|
146
|
-
|
|
140
|
+
src: {
|
|
141
|
+
// Build all blocks in src/blocks/
|
|
142
|
+
"blocks": true,
|
|
143
|
+
|
|
144
|
+
// Build block extensions from src/extensions/
|
|
145
|
+
"extensions": {directoryLayout: 'extensions'},
|
|
146
|
+
|
|
147
|
+
// Auto-load in the head on frontend
|
|
148
|
+
"site/index-header.ts": {
|
|
149
|
+
locations: {
|
|
150
|
+
clientView: true,
|
|
151
|
+
registerScriptArgs: false
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
// Auto-load at the bottom of the body on frontend
|
|
156
|
+
"site/index-footer.ts": {
|
|
157
|
+
locations: {
|
|
158
|
+
clientView: true,
|
|
159
|
+
registerScriptArgs: 'lazy'
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
// Auto-load in admin
|
|
163
|
+
"site/wp-admin.ts": {
|
|
164
|
+
locations: {
|
|
165
|
+
admin: true
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
// Auto-load in admin
|
|
169
|
+
"site/wp-admin.pcss": {
|
|
170
|
+
locations: {
|
|
171
|
+
admin: true
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
// Auto-load in the block editor
|
|
175
|
+
"site/block-editor.pcss": {
|
|
176
|
+
locations: {
|
|
177
|
+
clientEditor: true
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
// Auto-load in the head on frontend
|
|
181
|
+
"site/public.pcss": {
|
|
182
|
+
locations: {
|
|
183
|
+
clientView: true
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
// A script that can be enqueued via its handle, but is not autoloaded
|
|
187
|
+
"site/manually-loaded.ts": {
|
|
188
|
+
locations: "plaudit-theme/manually-loaded-script"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
useWebpackResourceFiltering: true, // Always use this!
|
|
192
|
+
extensionsVersion: 3,
|
|
193
|
+
plainEntrypointsVersion: 2,
|
|
194
|
+
srcDir: "src", // Always use this!
|
|
195
|
+
outputDir: "dist", // Always use this!
|
|
196
|
+
useUnifiedLoader: true, // Always use this!
|
|
147
197
|
variables: {
|
|
148
198
|
font_size: 16 // Required for pxAsRem to work; replace the 16 with your site's base font size
|
|
149
199
|
}
|
|
150
200
|
});
|
|
151
201
|
```
|
|
152
|
-
The `standard` key is shorthand to the standard set of flags as of the given date. See the [Standard Flag Sets](#standard-flag-sets) section for details.
|
|
153
202
|
|
|
154
203
|
### 2. Set Up Your File Structure
|
|
155
204
|
|
|
156
205
|
**Blocks** (subdirectories with block.json):
|
|
157
|
-
- **Config:**
|
|
206
|
+
- **Config:** `'blocks': true`
|
|
158
207
|
- **File Structure:** [See Here](#file-structure)
|
|
159
208
|
|
|
160
209
|
**Extensions** (flat files that modify existing blocks):
|
|
161
|
-
- **Config:**
|
|
210
|
+
- **Config:** `'extensions': {directoryLayout: 'extensions'}`
|
|
162
211
|
- **File Structure:** [See Here](#file-structure-1)
|
|
163
212
|
|
|
164
213
|
**Other Files** (scripts, styles):
|
|
165
|
-
- **Config:**
|
|
214
|
+
- **Config:** List each file individually in `src` object
|
|
166
215
|
- **File Structure:** [See Here](#file-structure-2)
|
|
167
216
|
|
|
168
217
|
### 3. Include unified-loader.php in Your Plugin
|
|
@@ -216,7 +265,7 @@ After building, each asset gets a handle you can reference in PHP.
|
|
|
216
265
|
**Best way:** Check the generated loader files after building:
|
|
217
266
|
- `dist/blocks/blocks-loader.php`
|
|
218
267
|
- `dist/extensions/extensions-loader.php`
|
|
219
|
-
- The first argument of the `wp_register_script` and `wp_register_style` calls in `dist/plain-entrypoints-loader.php`
|
|
268
|
+
- The first argument of the `wp_register_script` and `wp_register_style` calls in `dist/plain-entrypoints-loader.php`
|
|
220
269
|
|
|
221
270
|
### Example: Manual Enqueue with Localization
|
|
222
271
|
|
|
@@ -303,106 +352,27 @@ src: {
|
|
|
303
352
|
# Reference
|
|
304
353
|
|
|
305
354
|
## Root Options
|
|
306
|
-
| Option | Type | Default
|
|
307
|
-
|
|
308
|
-
| `
|
|
309
|
-
| `
|
|
310
|
-
| `
|
|
311
|
-
| `
|
|
312
|
-
| `
|
|
313
|
-
| `
|
|
314
|
-
| `
|
|
315
|
-
| `
|
|
316
|
-
| `
|
|
317
|
-
| `
|
|
318
|
-
| `
|
|
319
|
-
| `
|
|
320
|
-
| `
|
|
321
|
-
| `targetHandlePrefix` | `string` | Auto | **[Legacy]** Prefix for handles. Auto-detected from composer.json if omitted. Do not set this unless absolutely necessary |
|
|
322
|
-
|
|
323
|
-
### Standard Flag Sets
|
|
324
|
-
Each flag set is identified by the date that it was added to the standards set. Individual values can be overridden by specifying them in the config file
|
|
325
|
-
|
|
326
|
-
**2026-03-13**
|
|
327
|
-
```javascript
|
|
328
|
-
{
|
|
329
|
-
useWebpackResourceFiltering: true,
|
|
330
|
-
extensionsVersion: 3,
|
|
331
|
-
plainEntrypointsVersion: 2,
|
|
332
|
-
srcDir: "src",
|
|
333
|
-
outputDir: "dist",
|
|
334
|
-
useUnifiedLoader: true,
|
|
335
|
-
onlyRunPostCSSOnPCSS: true,
|
|
336
|
-
}
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
## Location-Encoding Filenames
|
|
342
|
-
This section covers how asset emission locations can be encoded in filenames.
|
|
343
|
-
While every common flag is accounted for in this schema, there are some things that cannot be encoded in filenames that will require enumeration in the `webpack.config.js` file's `src` object.
|
|
344
|
-
|
|
345
|
-
Location-encoding filenames are composed of two or more `.`-separated segments (the file extension being one of those segments).
|
|
346
|
-
The following is a brief list of notes followed by a breakdown of the individual segments:
|
|
347
|
-
- The only required segments are the location and type segments (the type segment is the file extension).
|
|
348
|
-
- So long as there is at least one location and type segment (the type segment MUST be last), "invalid" segments are allowed so that files can be given human-readable names
|
|
349
|
-
- Each file can list any combination enqueuing locations
|
|
350
|
-
- The first item is special in that, if it encodes a location, it can optionally be suffixed with a type override (see the [Enqueuing Location](#enqueuing-location) section for more details)
|
|
351
|
-
|
|
352
|
-
Notes on how to read the following table:
|
|
353
|
-
- Brackets in the token column mean "optional section"
|
|
354
|
-
- `(-|=)` means "this can be either a dash or an equal sign"
|
|
355
|
-
- Pipe-separated items in parentheses means "any one of these items can go here"
|
|
356
|
-
|
|
357
|
-
| Name | Token | Usage |
|
|
358
|
-
|--------------------|-------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
359
|
-
| Enqueuing Location | `(enqueuing-location)[(-\|=)priority]` | This is a special section that is actually a collection of values. See the [Enqueuing Location](#enqueuing-location) section for more details |
|
|
360
|
-
| Type Override | `script`, `style`, `script-module` | Can be used to override the detected of the asset. Must be the first token in the filename; if used directly, it is shorthand for `both-(Type Override)` |
|
|
361
|
-
| Inline | `inline[(-\|=)position]`, `strategy(-\|=)inline[-position]` | Indicates that the script should be inlined. `position` can be either `before` or `after` |
|
|
362
|
-
| Strategy | `lazy\|eager`, `strategy(-\|=)(lazy\|eager\|defer\|async)` | Controls the loading strategy. Lazy and eager have shorthand while the remaining values must be prefixed with `strategy` |
|
|
363
|
-
| Fetch Priority | `fetchpriority(-\|=)(low\|high\|auto)` | Controls the fetchpriority property; `auto` is the default |
|
|
364
|
-
| In Footer | `in-footer`, `in_footer` | Sets the `in_footer` value to `true`; incompatible with `in-header` |
|
|
365
|
-
| In Header | `in-header`, `in_header` | Sets the `in_footer` value to `false`; incompatible with `in-footer` |
|
|
366
|
-
| Extension | `([ps]?c\|sa)ss`, `m?[jt]sx?` | This determines the type unless it is overridden. This **MUST** be the last token in the name (it is the file extension) |
|
|
367
|
-
|
|
368
|
-
### Enqueuing Location
|
|
369
|
-
If this is the first token, it can be suffixed with `-script`, `-style`, or `-script-module` to override the type.
|
|
370
|
-
Specifying the type override alone is interpreted as `both-(Type Override)` for compatibility with how blocks expect assets to be named.
|
|
371
|
-
|
|
372
|
-
Blocks do not support anything other than `view`, `editor`, and `both` (typically written as `script` or `style`).
|
|
373
|
-
|
|
374
|
-
**Valid Values**:
|
|
375
|
-
|
|
376
|
-
| Token | Meaning |
|
|
377
|
-
|-------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
|
|
378
|
-
| `view`, `client-view`, `clientView` | Enqueue the asset on the frontend (the part of the site seen by visitors) |
|
|
379
|
-
| `editor`, `client-editor`, `clientEditor` | Enqueue the asset in the *display* portion of the block editor |
|
|
380
|
-
| `both` | Shorthand for `view.editor` |
|
|
381
|
-
| `block-assets`, `block-assets` | Enqueue the asset in the *wrapper* portion of the block editor |
|
|
382
|
-
| `admin` | Enqueue the asset in the admin area |
|
|
383
|
-
| `login` | Enqueue the asset on the standard login page |
|
|
384
|
-
| `customizer` | Enqueue the asset in the legacy customizer interface |
|
|
385
|
-
| `analytics` | Enqueue the asset when analytics scripts have been accepted by the visitor (this "location" is unique to Plaudit's systems) |
|
|
386
|
-
| `register` | Register the asset *without* enqueuing it anywhere (this is primarily useful when localizing the asset) |
|
|
387
|
-
|
|
388
|
-
### Examples
|
|
389
|
-
#### Block- and Plain-compatible
|
|
390
|
-
- **A view script**: `view.ts`
|
|
391
|
-
- **An editor script**: `editor.ts`
|
|
392
|
-
- **A view and editor script**: `script.ts`
|
|
355
|
+
| Option | Type | Default | Description |
|
|
356
|
+
|------------------------------------|-----------|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
357
|
+
| `src` | `object` | **Required** | Files/directories to process (see the next section for what you can put in here) |
|
|
358
|
+
| `srcDir` | `string` | `""` | Source directory (**Required** on new sites) |
|
|
359
|
+
| `outputDir` | `string` | `""` | Output directory (**Required** on new sites) |
|
|
360
|
+
| `useUnifiedLoader` | `boolean` | `false` | Generate unified-loader.php (always set to `true` on new sites!) |
|
|
361
|
+
| `useWebpackResourceFiltering` | `boolean` | `false` | Generates versioned copies of images, fonts, etc (always set to `true` on new sites!) |
|
|
362
|
+
| `plainEntrypointsVersion` | `1\|2` | `1` | Use 2 for new sites |
|
|
363
|
+
| `extensionsVersion` | `1\|2\|3` | `1` | Use 3 for new sites |
|
|
364
|
+
| `verbose` | `boolean` | `false` | Verbose logging |
|
|
365
|
+
| `variables` | `object` | Auto | CSS/JS variables. If a variables.js file is present, this will automatically load from that file |
|
|
366
|
+
| `onlyRunPostCSSOnPCSS` | `boolean` | `false` | If true, the PostCSS processor will not be run on CSS files. This is true for all new sites and can be safely enabled on most sites if desired. |
|
|
367
|
+
| `assumeGlobalizedPlauditLibraries` | `boolean` | `true` | **[Advanced]** When `false`, normally-externalized plaudit libraries will be included.<br>**DO NOT USE THIS. IF YOU SEE IT BEING USED, CONTACT JOSH** |
|
|
368
|
+
| `externals` | `object` | - | **[Advanced]** Allows dependencies to be marked as external. This prevents them from being included in the bundle under the assumption that they will be provided via an alternate mechanism |
|
|
369
|
+
| `targetHandlePrefix` | `string` | Auto | **[Legacy]** Prefix for handles. Auto-detected from composer.json if omitted. Do not set this unless absolutely necessary |
|
|
393
370
|
|
|
394
371
|
---
|
|
395
372
|
|
|
396
373
|
## Per-Entrypoint Options
|
|
397
374
|
This section covers the shared options for entrypoints. See the [Entrypoint Types](#entrypoint-types) section for options specific to individual types
|
|
398
375
|
|
|
399
|
-
### Path Queries
|
|
400
|
-
- These are URL-style queries added to the end of entrypoint *source* paths and are used to set entrypoint-specific properties in Plain and Block contexts.
|
|
401
|
-
- If you find yourself using these, consider switching to [Location-Encoding Filenames](#location-encoding-filenames)
|
|
402
|
-
- At present, this is only being used to configure inlining, but expansion to other systems is being considered
|
|
403
|
-
- The available options are: `strategy`, `inline`, `in_footer`, `fetchpriority`, `position`, and `handle`
|
|
404
|
-
- Handle is only available on blocks – declare the handle using the [Locations object](#the-locations-object)
|
|
405
|
-
|
|
406
376
|
### Boolean-form
|
|
407
377
|
- This is only available if `outputDir` has been set
|
|
408
378
|
- The only supported value is `true` and only works for `blocks` and `plain` entrypoints. It means that every value will have its default value
|
|
@@ -472,7 +442,7 @@ If you use both methods for the same entrypoint, the dependencies from the confi
|
|
|
472
442
|
## Entrypoint Types
|
|
473
443
|
|
|
474
444
|
### Blocks
|
|
475
|
-
This was
|
|
445
|
+
This was first entrypoint type added, and, due to how it integrates with WordPress, it both has and needs the least amount of configuration.
|
|
476
446
|
In fact, under most circumstances, the proper configuration value is just `true`.
|
|
477
447
|
|
|
478
448
|
#### File Structure
|
|
@@ -489,8 +459,7 @@ src/blocks/
|
|
|
489
459
|
#### Notes
|
|
490
460
|
- Blocks **should** be created with `pnpm @plaudit/scaffold create block`
|
|
491
461
|
- template.php and setup.php files are automatically loaded; however, they can be manually specified if desired
|
|
492
|
-
- Script and Style files **must** be specified using the `file:./<path here
|
|
493
|
-
- The `[?path-query-here]` component is something that we added. You can see more details in its section [here](#path-queries)
|
|
462
|
+
- Script and Style files **must** be specified using the `file:./<path here>` syntax in the appropriate keys. See [WordPress' `block.json` reference](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/) for further details
|
|
494
463
|
|
|
495
464
|
#### Per-Entrypoint Options
|
|
496
465
|
The `blocks` entrypoint type doesn't have any.
|
|
@@ -502,10 +471,8 @@ This is used to associate additional assets with blocks that are not in control
|
|
|
502
471
|
[Specially named files](#file-naming) in a single subdirectory of `src`
|
|
503
472
|
```
|
|
504
473
|
src/extensions/
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
│ └─ editor.pcss
|
|
508
|
-
└─ plaudit/block-library/accordion/style.pcss
|
|
474
|
+
├── core-paragraph-view-script.ts
|
|
475
|
+
└── core-paragraph-editor-style.pcss
|
|
509
476
|
```
|
|
510
477
|
|
|
511
478
|
#### File Naming
|
|
@@ -516,12 +483,9 @@ Filenames **must** follow the pattern: `{kebab-case-block-name}-{type}.{ext}`
|
|
|
516
483
|
- `script-module`, `view-script-module`
|
|
517
484
|
- `setup` (this allows for PHP code to be loaded only when certain blocks are enabled and is intended for use in plugins, not themes)
|
|
518
485
|
- `ext` **must** be for a [supported file type](#supported-file-types) and **should** correspond with the extension type (basically, don't enqueue a `.css` file as a script)
|
|
519
|
-
- For convenience, everything before the `{type}` can be split into directories on the hyphens
|
|
520
|
-
- When using this format, the filenames must be [Location-Encoding Filenames](#location-encoding-filenames) or `setup.php`
|
|
521
|
-
- This is only available in extensions v2 and up
|
|
522
486
|
|
|
523
487
|
#### Notes
|
|
524
|
-
-
|
|
488
|
+
- In order to have a directory be treated as `extensions`, the config **must** include `directoryLayout: 'extensions'`
|
|
525
489
|
- Extensions **should** be created with `pnpm @plaudit/scaffold create extension`
|
|
526
490
|
|
|
527
491
|
#### Per-Entrypoint Options
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { Compilation } from "webpack";
|
|
2
|
-
import type WebpackRemoveEmptyScriptsPlugin from "webpack-remove-empty-scripts";
|
|
3
1
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
4
|
-
import { ParsedAssetsJson, BlockEntrypointInfo, FileSegmentBlockEntrypointInfo, VerifiedAdvancedOutputConfig, ParsedAssetJsonProvider
|
|
2
|
+
import { ParsedAssetsJson, BlockEntrypointInfo, FileSegmentBlockEntrypointInfo, VerifiedAdvancedOutputConfig, ParsedAssetJsonProvider } from "../shared";
|
|
5
3
|
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
6
|
-
|
|
4
|
+
import { Compilation } from "webpack";
|
|
5
|
+
import type WebpackRemoveEmptyScriptsPlugin from "webpack-remove-empty-scripts";
|
|
6
|
+
type WorkableBlockEntrypointInfo = Omit<FileSegmentBlockEntrypointInfo, 'originalValue'> & Partial<Pick<FileSegmentBlockEntrypointInfo, 'originalValue'>> & {
|
|
7
7
|
outputPath: string;
|
|
8
8
|
assetData: ParsedAssetsJson[string];
|
|
9
9
|
hash: string;
|
|
10
|
-
scriptArgsObject: ScriptArgsObject | undefined;
|
|
11
|
-
inlinedAsset: InlinedAsset | undefined;
|
|
12
10
|
};
|
|
13
11
|
type CollatedWorkableBlockInfo = Record<string, {
|
|
14
12
|
sourcePath?: string;
|
|
@@ -22,7 +20,6 @@ export declare class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEnt
|
|
|
22
20
|
constructor(config: VerifiedPlauditWordpressWebpackConfig, dest: VerifiedAdvancedOutputConfig, webpackRemoveEmptyScriptsPlugin: WebpackRemoveEmptyScriptsPlugin, context: string, entry: EntryProvider<BlockEntrypointInfo>);
|
|
23
21
|
protected processAssets(compilation: Compilation, parsedAssetJsonProvider: ParsedAssetJsonProvider): Promise<void>;
|
|
24
22
|
private emitBlockLoaderFile;
|
|
25
|
-
private callRegisterFunction;
|
|
26
23
|
private transformBlocks;
|
|
27
24
|
private static extractAssetSource;
|
|
28
25
|
private static convertToScriptHandles;
|