@plaudit/webpack-extensions 2.84.0 → 2.84.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.
- package/CHANGELOG.md +4 -0
- package/USER-GUIDE.md +589 -0
- package/build/plugins/AbstractBiPhasicGroupPlugin.d.ts +3 -3
- package/build/plugins/BrowserSyncPlugin.d.ts +3 -2
- package/build/plugins/MiniCSSExtractPluginErrorCleaner.d.ts +3 -2
- package/build/plugins/PackageConfigSanityChecker.d.ts +3 -2
- package/build/plugins/VariablesJSMonitorPlugin.d.ts +3 -2
- package/build/plugins/WPMLConfigBuilder.d.ts +3 -2
- package/build/shared.d.ts +4 -1
- package/build/utils/common-config-helpers.d.ts +2 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ 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
|
+
## [2.84.1] - 2026-02-11
|
|
9
|
+
### Fixed
|
|
10
|
+
- Typedef compatibility issues with Webpack 5.105.0
|
|
11
|
+
|
|
8
12
|
## [2.84.0] - 2026-01-30
|
|
9
13
|
### Added
|
|
10
14
|
- Support for using `lazyLoader` on plain entrypoints
|
package/USER-GUIDE.md
ADDED
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
<!-- TOC -->
|
|
2
|
+
* [General Information](#general-information)
|
|
3
|
+
* [What is This?](#what-is-this)
|
|
4
|
+
* [Why is This?](#why-is-this)
|
|
5
|
+
* [How to Read This Guide](#how-to-read-this-guide)
|
|
6
|
+
* [General](#general)
|
|
7
|
+
* [Paths](#paths)
|
|
8
|
+
* [Examples](#examples)
|
|
9
|
+
* [Best Practices](#best-practices)
|
|
10
|
+
* [Folder Structure](#folder-structure)
|
|
11
|
+
* [Blocks](#blocks)
|
|
12
|
+
* [Extensions](#extensions)
|
|
13
|
+
* [Plain Assets](#plain-assets)
|
|
14
|
+
* [Configuration](#configuration)
|
|
15
|
+
* [Quick Start](#quick-start)
|
|
16
|
+
* [1. Create webpack.config.js](#1-create-webpackconfigjs)
|
|
17
|
+
* [2. Set Up Your File Structure](#2-set-up-your-file-structure)
|
|
18
|
+
* [3. Include unified-loader.php in Your Plugin](#3-include-unified-loaderphp-in-your-plugin)
|
|
19
|
+
* [4. Run Build Commands](#4-run-build-commands)
|
|
20
|
+
* [Using Asset Handles in PHP](#using-asset-handles-in-php)
|
|
21
|
+
* [Handle Format](#handle-format)
|
|
22
|
+
* [Finding Your Handles](#finding-your-handles)
|
|
23
|
+
* [Example: Manual Enqueue with Localization](#example-manual-enqueue-with-localization)
|
|
24
|
+
* [Common Patterns](#common-patterns)
|
|
25
|
+
* [Pattern 1: Frontend-Only Script](#pattern-1-frontend-only-script)
|
|
26
|
+
* [Pattern 2: Conditional Loading (Manual Enqueue)](#pattern-2-conditional-loading-manual-enqueue)
|
|
27
|
+
* [Pattern 3: Admin-Only Styles](#pattern-3-admin-only-styles)
|
|
28
|
+
* [Pattern 4: Block Editor Styles](#pattern-4-block-editor-styles)
|
|
29
|
+
* [Reference](#reference)
|
|
30
|
+
* [Root Options](#root-options)
|
|
31
|
+
* [Per-Entrypoint Options](#per-entrypoint-options)
|
|
32
|
+
* [Boolean-form](#boolean-form)
|
|
33
|
+
* [String-form](#string-form)
|
|
34
|
+
* [Object-form](#object-form)
|
|
35
|
+
* [Additional Dependencies](#additional-dependencies)
|
|
36
|
+
* [In webpack.config.js (per entrypoint)](#in-webpackconfigjs-per-entrypoint)
|
|
37
|
+
* [First-line comment in the entry source file](#first-line-comment-in-the-entry-source-file)
|
|
38
|
+
* [Entrypoint Types](#entrypoint-types)
|
|
39
|
+
* [Blocks](#blocks-1)
|
|
40
|
+
* [File Structure](#file-structure)
|
|
41
|
+
* [Notes](#notes)
|
|
42
|
+
* [Per-Entrypoint Options](#per-entrypoint-options-1)
|
|
43
|
+
* [Extensions](#extensions-1)
|
|
44
|
+
* [File Structure](#file-structure-1)
|
|
45
|
+
* [File Naming](#file-naming)
|
|
46
|
+
* [Notes](#notes-1)
|
|
47
|
+
* [Per-Entrypoint Options](#per-entrypoint-options-2)
|
|
48
|
+
* [Plain](#plain)
|
|
49
|
+
* [File Structure](#file-structure-2)
|
|
50
|
+
* [Per-Entrypoint Options](#per-entrypoint-options-3)
|
|
51
|
+
* [The Locations Object](#the-locations-object)
|
|
52
|
+
* [WordPress Types](#wordpress-types)
|
|
53
|
+
* [WordPress Script Args](#wordpress-script-args)
|
|
54
|
+
* [Supported File Types](#supported-file-types)
|
|
55
|
+
* [Need Help?](#need-help)
|
|
56
|
+
<!-- TOC -->
|
|
57
|
+
|
|
58
|
+
# General Information
|
|
59
|
+
|
|
60
|
+
## What is This?
|
|
61
|
+
|
|
62
|
+
This webpack wrapper automates the process of compiling and loading assets for WordPress sites.
|
|
63
|
+
It is guaranteed to work on all Plaudit-made themes and plugins and can be dropped into most non-Plaudit-made plugins and themes with minimal edits to their structure.
|
|
64
|
+
|
|
65
|
+
It does this by taking advantage of patterns in how WordPress expects assets to be provided combined with a dash of template-generated PHP.
|
|
66
|
+
|
|
67
|
+
You only need to configure `webpack.config.js` and run `pnpm run watch` or `pnpm run build`.
|
|
68
|
+
|
|
69
|
+
## Why is This?
|
|
70
|
+
|
|
71
|
+
This webpack wrapper started out as a method of mapping the source names to destination names automatically. Over time, it has expanded to automate all the mapping that WordPress expects developers to do manually.
|
|
72
|
+
Its output has *significant* performance boosts compared to what following WordPress's guides will get by eliminating *all* folder iteration and replacing the `O(N)` asset configuration loading that following WordPress' guides produces with one that requires only a single file per entrypoint category (root loader, image/font/etc assets, blocks, extensions, and plain).
|
|
73
|
+
|
|
74
|
+
In addition to the improved loading performance and working as a vehicle for distributing improvements to the loading code across sites (even when the loading code is in unmanaged themes and plugins), it also provides a few minor enhancements over WordPress' own webpack wrapper:
|
|
75
|
+
- CSS versioning
|
|
76
|
+
- While WordPress *appears* to generate version hashes for CSS files, they aren't actually based on the contents of the CSS files
|
|
77
|
+
- Automatic filename conflict resolution
|
|
78
|
+
- This one isn't strictly necessary, but if you want to have both `view-script.ts` and `view-style.pcss`, this'll make it work!
|
|
79
|
+
- This conflict handling also extends to taking steps to avoid assets conflicting with ones from other plugins or themes
|
|
80
|
+
- Non-bundled asset versioning (images, fonts, etc)
|
|
81
|
+
- This is a standard webpack feature. It's just disabled by how WordPress's stuff
|
|
82
|
+
|
|
83
|
+
When combined with [`pnpx @plaudit/scaffold`](https://bitbucket.org/plaudit/scaffold/src/main/README.md), no manual configuration should be needed for 99% of client work.
|
|
84
|
+
However, if you need to do something unusual or just want to know what everything in the config file actually does, this guide is for you!
|
|
85
|
+
|
|
86
|
+
## How to Read This Guide
|
|
87
|
+
### General
|
|
88
|
+
- When in doubt, roll with the default
|
|
89
|
+
- Due to naming differences, you will sometimes see `Entrypoint` being used to refer to things in the `src` object
|
|
90
|
+
- For brevity, "assets" will be used in place of "scripts and styles"
|
|
91
|
+
- This guide assumes that you are using the most recent versions of the loader logic
|
|
92
|
+
- This guide is primarily informational, so you will be seeing the *every* flag, not just "recommended" ones
|
|
93
|
+
- If what you are looking at seems weirdly specific or excessively complicated, check if it's marked with **[Advanced]** or **[Legacy]**. There are a lot of highly situational and/or weird flags that are only useful when hyper-optimizing asset loading
|
|
94
|
+
|
|
95
|
+
### Paths
|
|
96
|
+
- Any time that `src` is referenced in a path, it should be replaced with the value of `srcDir` in your WebPack file
|
|
97
|
+
- To be crystal clear, the value of `srcDir` *should be* `src`; however, this might not be the case in some inherited or older code
|
|
98
|
+
- Any time that `dist` is referenced in a path, it should be replaced with the value of `outputDir` in your WebPack file
|
|
99
|
+
- As with `src`, the value of `outputDir` *should be* `dist`; however, this might not be the case in some inherited or older code
|
|
100
|
+
- Keys in the `src` *object* are all assumed to be paths relative to `srcDir` if it is specified or the folder in which the `webpack.config.js` file is located if it is not specified
|
|
101
|
+
- Paths in values in the `src` *object* are all assumed to be paths relative to `outputDir` if it is specified or the folder in which the `webpack.config.js` file is located if it is not specified
|
|
102
|
+
- All file names are informational placeholders. They can be whatever you want provided that they are web-safe (basically, don't do things like calling the email address block "✉️" and you'll be fine)
|
|
103
|
+
|
|
104
|
+
### Examples
|
|
105
|
+
- Any uses of `acme-my-plugin` should be replaced with your plugin or theme's kebab-case name (ex: `acme-my-plugin.wp-admin` => `plaudit-base.wp-admin`)
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Best Practices
|
|
110
|
+
### Folder Structure
|
|
111
|
+
- All folder and file names should be in kebab-case
|
|
112
|
+
- Assets *should not* be in the root of the `src` folder. Assets that aren't block- or extension-bound should be in the `site` folder (or in a folder named after where they'll be used like, `admin` or `map-page`)
|
|
113
|
+
|
|
114
|
+
### Blocks
|
|
115
|
+
- Block folder names *should* match the local portion of their name (ex: `plaudit-query-loop-maps/address-wrapper` should be stored in `address-wrapper`)
|
|
116
|
+
|
|
117
|
+
### Extensions
|
|
118
|
+
- Extensions *should not* be repeated for multiple blocks. If you find that happening, move it to a site-level asset that gets loaded at the appropriate time.
|
|
119
|
+
- This can be done pretty easily via `pnpm dlx @plaudit/scaffold add site asset`
|
|
120
|
+
- Extensions *should not* be applied to site-specific blocks (basically, only use extensions for stuff that is from WordPress, pulled in via composer, or is from a 3rd party)
|
|
121
|
+
|
|
122
|
+
### Plain Assets
|
|
123
|
+
- Plain assets *should be your last option*. They have the least amount of granularity in where they can be included, which can easily lead to serving bloated code.
|
|
124
|
+
- Just because you *can* have multiple folders doesn't mean that you *should*
|
|
125
|
+
|
|
126
|
+
### Configuration
|
|
127
|
+
- A good configuration file is one that does not include any unnecessary configuration (ex: if you won't be manually enqueuing an asset or referencing it elsewhere, don't give it a named handle)
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Quick Start
|
|
132
|
+
|
|
133
|
+
### 1. Create webpack.config.js
|
|
134
|
+
This is automatically created and populated when running any [scaffold](https://bitbucket.org/plaudit/scaffold/src/main/README.md) command.
|
|
135
|
+
|
|
136
|
+
The config tells webpack **what** to build and **where** to load it in WordPress.
|
|
137
|
+
|
|
138
|
+
```javascript
|
|
139
|
+
module.exports = require("@plaudit/webpack-extensions/wordpress-scripts-wrapper")({
|
|
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!
|
|
197
|
+
variables: {
|
|
198
|
+
font_size: 16 // Required for pxAsRem to work; replace the 16 with your site's base font size
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 2. Set Up Your File Structure
|
|
204
|
+
|
|
205
|
+
**Blocks** (subdirectories with block.json):
|
|
206
|
+
- **Config:** `'blocks': true`
|
|
207
|
+
- **File Structure:** [See Here](#file-structure)
|
|
208
|
+
|
|
209
|
+
**Extensions** (flat files that modify existing blocks):
|
|
210
|
+
- **Config:** `'extensions': {directoryLayout: 'extensions'}`
|
|
211
|
+
- **File Structure:** [See Here](#file-structure-1)
|
|
212
|
+
|
|
213
|
+
**Other Files** (scripts, styles):
|
|
214
|
+
- **Config:** List each file individually in `src` object
|
|
215
|
+
- **File Structure:** [See Here](#file-structure-2)
|
|
216
|
+
|
|
217
|
+
### 3. Include unified-loader.php in Your Plugin
|
|
218
|
+
After building, include the generated loader file in the plugin's main PHP file. [Scaffold](https://bitbucket.org/plaudit/scaffold/src/main/README.md) commands will offer to add this to the plugin file if needed.
|
|
219
|
+
|
|
220
|
+
**Example:**
|
|
221
|
+
```php
|
|
222
|
+
<?php
|
|
223
|
+
/**
|
|
224
|
+
* Plugin Name: My Plugin
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
@include_once __DIR__ . '/dist/unified-loader.php';
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
This file automatically:
|
|
231
|
+
- Registers all your scripts and styles
|
|
232
|
+
- Enqueues them in the right places
|
|
233
|
+
- Handles dependencies
|
|
234
|
+
- Sets up blocks and extensions
|
|
235
|
+
|
|
236
|
+
### 4. Run Build Commands
|
|
237
|
+
While you *can* manually run these commands, using `theapp pack dev/watch/build` is preferred
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
pnpm run watch # Development mode (watches for changes)
|
|
241
|
+
pnpm run build # Production build
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Using Asset Handles in PHP
|
|
247
|
+
|
|
248
|
+
After building, each asset gets a handle you can reference in PHP.
|
|
249
|
+
|
|
250
|
+
### Handle Format
|
|
251
|
+
|
|
252
|
+
**Plain:** `{prefix}.{filename}`
|
|
253
|
+
- Example: `acme-my-plugin.admin-editor`
|
|
254
|
+
|
|
255
|
+
**Blocks:** `{prefix}_blocks_{block-name}-{type}`
|
|
256
|
+
- Example: `acme-my-plugin_blocks_hero-banner-editor-script`
|
|
257
|
+
- Block handles are subject to runtime-change, so they cannot be safely referenced
|
|
258
|
+
|
|
259
|
+
**Extensions:** `{prefix}_block-extensions_{block-name}-{type}`
|
|
260
|
+
- Example: `acme-my-plugin_block-extensions_hero-banner-editor-script`
|
|
261
|
+
- Extension handles are subject to runtime-change, so they cannot be safely referenced
|
|
262
|
+
|
|
263
|
+
### Finding Your Handles
|
|
264
|
+
|
|
265
|
+
**Best way:** Check the generated loader files after building:
|
|
266
|
+
- `dist/blocks/blocks-loader.php`
|
|
267
|
+
- `dist/extensions/extensions-loader.php`
|
|
268
|
+
- The first argument of the `wp_register_script` and `wp_register_style` calls in `dist/plain-entrypoints-loader.php`
|
|
269
|
+
|
|
270
|
+
### Example: Manual Enqueue with Localization
|
|
271
|
+
|
|
272
|
+
```php
|
|
273
|
+
<?php
|
|
274
|
+
// For manually-enqueued assets
|
|
275
|
+
add_action('admin_enqueue_scripts', function($hook) {
|
|
276
|
+
if ($hook === 'post.php') {
|
|
277
|
+
// Localize data first (optional)
|
|
278
|
+
wp_localize_script('acme-my-plugin.admin-editor', 'myData', [
|
|
279
|
+
'ajaxUrl' => admin_url('admin-ajax.php'),
|
|
280
|
+
'nonce' => wp_create_nonce('my_ajax_action'),
|
|
281
|
+
]);
|
|
282
|
+
|
|
283
|
+
// Then enqueue
|
|
284
|
+
wp_enqueue_script('acme-my-plugin.admin-editor');
|
|
285
|
+
wp_enqueue_style('acme-my-plugin.admin-editor');
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Common Patterns
|
|
293
|
+
|
|
294
|
+
### Pattern 1: Frontend-Only Script
|
|
295
|
+
|
|
296
|
+
```javascript
|
|
297
|
+
// webpack.config.js
|
|
298
|
+
src: {
|
|
299
|
+
'site/public.ts': {
|
|
300
|
+
locations: {
|
|
301
|
+
clientView: true,
|
|
302
|
+
registerScriptArgs: 'lazy'
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Pattern 2: Conditional Loading (Manual Enqueue)
|
|
309
|
+
|
|
310
|
+
```javascript
|
|
311
|
+
// webpack.config.js
|
|
312
|
+
src: {
|
|
313
|
+
'post-editor.ts': {
|
|
314
|
+
locations: { register: true } // Don't auto-load
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
```php
|
|
320
|
+
<?php
|
|
321
|
+
// In your plugin
|
|
322
|
+
add_action('admin_enqueue_scripts', function($hook) {
|
|
323
|
+
if ($hook === 'post.php') {
|
|
324
|
+
wp_enqueue_script('acme-my-plugin.post-editor');
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Pattern 3: Admin-Only Styles
|
|
330
|
+
|
|
331
|
+
```javascript
|
|
332
|
+
src: {
|
|
333
|
+
'admin/styles.pcss': {
|
|
334
|
+
locations: { admin: true }
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Pattern 4: Block Editor Styles
|
|
340
|
+
|
|
341
|
+
```javascript
|
|
342
|
+
// webpack.config.js
|
|
343
|
+
src: {
|
|
344
|
+
'editor/custom-editor-styles.pcss': {
|
|
345
|
+
locations: { clientEditor: true }
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
# Reference
|
|
353
|
+
|
|
354
|
+
## Root Options
|
|
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 |
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Per-Entrypoint Options
|
|
374
|
+
This section covers the shared options for entrypoints. See the [Entrypoint Types](#entrypoint-types) section for options specific to individual types
|
|
375
|
+
|
|
376
|
+
### Boolean-form
|
|
377
|
+
- This is only available if `outputDir` has been set
|
|
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
|
|
379
|
+
- In the case of `plain` entrypoints, they will need to be manually enqueued, so using it is not advised - it's just *technically* possible
|
|
380
|
+
- The reason that it doesn't work for `extensions` entrypoints is that `extensions` are not reliably distinguishable from `blocks` and `blocks` is the default entrypoint type
|
|
381
|
+
- The output directory will be the same as the source directory except that it will be under the `outputDir`
|
|
382
|
+
|
|
383
|
+
### String-form
|
|
384
|
+
- This is only available for `blocks` and `plain` entrypoints
|
|
385
|
+
- This is equivalent to `{destination: <value here>}`
|
|
386
|
+
- It is otherwise the same as the [Boolean form](#boolean-form)
|
|
387
|
+
- The value is treated as the output directory relative to `outputDir` if it is specified or the folder in which the `webpack.config.js` file is located if it is not specified
|
|
388
|
+
|
|
389
|
+
### Object-form
|
|
390
|
+
- This is necessary for `extensions` entrypoints and the preferred form for `plain` entrypoints
|
|
391
|
+
- In general, `blocks` entrypoints should use either [Boolean](#boolean-form)- or [String](#string-form)-form
|
|
392
|
+
- `plain` entrypoints have additional options available. They can be found in its [entrypoint type section](#plain)
|
|
393
|
+
|
|
394
|
+
| Option | Type | Default | Description |
|
|
395
|
+
|------------------------------------|-----------------------------|----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
396
|
+
| `directoryLayout` | `blocks\|extensions\|plain` | Auto | This should only be set for `extensions` entrypoints |
|
|
397
|
+
| `destination` | `string` | Auto when `outputDir` is set, none otherwise | **[Required when `outputDir` is not set]** Sets the output path<br>**This should not be set when `outputDir` is set** |
|
|
398
|
+
| `bundleAnalyzer` | `boolean` | `false` | **[Advanced]** Enable bundle analyzer |
|
|
399
|
+
| `lazyLoader` | `string` | - | **[Advanced]** **For `blocks` and `extensions` entrypoints only**<br>Specifies the name of a function that must be called in order to load the entrypoint<br>See [The Locations Object](#the-locations-object) for how to achieve this for `plain` entrypoints |
|
|
400
|
+
| `assumeGlobalizedPlauditLibraries` | `boolean` | Root Value | **[Advanced]** When `false`, normally-externalized plaudit libraries will be included.<br>**DO NOT USE THIS. IF YOU SEE IT BEING USED, CONTACT JOSH** |
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Additional Dependencies
|
|
405
|
+
|
|
406
|
+
When WordPress registers or enqueues a script or style, it accepts a **dependencies** argument: an array of handles that must be loaded before the asset. This library discovers most dependencies from your imports; however, for any dependency that is not imported (i.e., a script provided by another plugin that your bundle expects to be present at runtime), you can declare **additional dependencies** so they are included in the generated loader.
|
|
407
|
+
|
|
408
|
+
You can specify additional dependencies in either of two ways (or both - they are merged).
|
|
409
|
+
|
|
410
|
+
### In webpack.config.js (per entrypoint)
|
|
411
|
+
|
|
412
|
+
Set `additionalDependencies` on the entrypoint config. This applies to **plain** entrypoints (object-form) and any entrypoint type that supports the per-entrypoint options table above.
|
|
413
|
+
|
|
414
|
+
```javascript
|
|
415
|
+
// webpack.config.js
|
|
416
|
+
src: {
|
|
417
|
+
'site/checkout.ts': {
|
|
418
|
+
locations: { clientView: true },
|
|
419
|
+
additionalDependencies: ['axios', 'some-plugin/script-handle']
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
Dependencies are WordPress script/style handles (strings). They will be passed through as the `deps` array when the asset is registered.
|
|
425
|
+
|
|
426
|
+
### First-line comment in the entry source file
|
|
427
|
+
|
|
428
|
+
In the **first line** of the entrypoint source file (e.g., your `.ts` or `.js` file), you can use a special comment. If that line starts with `//ADDITIONAL_DEPENDENCIES:` (with no space after the colon in the prefix), the rest of the line is treated as a comma-separated list of dependency handles and added to the entrypoint’s additional dependencies.
|
|
429
|
+
|
|
430
|
+
```javascript
|
|
431
|
+
//ADDITIONAL_DEPENDENCIES: axios, some-plugin/script-handle
|
|
432
|
+
import { doCheckout } from './checkout-helpers';
|
|
433
|
+
// ...
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
This is useful when you want the dependency list to live next to the code that relies on it, or when different entrypoints are built from the same config and you want to vary dependencies per file.
|
|
437
|
+
|
|
438
|
+
If you use both methods for the same entrypoint, the dependencies from the config and from the first-line comment will be combined.
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## Entrypoint Types
|
|
443
|
+
|
|
444
|
+
### Blocks
|
|
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.
|
|
446
|
+
In fact, under most circumstances, the proper configuration value is just `true`.
|
|
447
|
+
|
|
448
|
+
#### File Structure
|
|
449
|
+
Subdirectories with block.json files
|
|
450
|
+
```
|
|
451
|
+
src/blocks/
|
|
452
|
+
├── hero-banner/
|
|
453
|
+
│ ├── block.json
|
|
454
|
+
│ ├── index.ts
|
|
455
|
+
│ ├── style.pcss
|
|
456
|
+
│ └── template.php
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
#### Notes
|
|
460
|
+
- Blocks **should** be created with `pnpm @plaudit/scaffold create block`
|
|
461
|
+
- template.php and setup.php files are automatically loaded; however, they can be manually specified if desired
|
|
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
|
|
463
|
+
|
|
464
|
+
#### Per-Entrypoint Options
|
|
465
|
+
The `blocks` entrypoint type doesn't have any.
|
|
466
|
+
|
|
467
|
+
### Extensions
|
|
468
|
+
This is used to associate additional assets with blocks that are not in control of the current project. This most-commonly means built-in WordPress blocks, but it can be used with any block.
|
|
469
|
+
|
|
470
|
+
#### File Structure
|
|
471
|
+
[Specially named files](#file-naming) in a single subdirectory of `src`
|
|
472
|
+
```
|
|
473
|
+
src/extensions/
|
|
474
|
+
├── core-paragraph-view-script.ts
|
|
475
|
+
└── core-paragraph-editor-style.pcss
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
#### File Naming
|
|
479
|
+
Filenames **must** follow the pattern: `{kebab-case-block-name}-{type}.{ext}`
|
|
480
|
+
- Valid values for `type` are:
|
|
481
|
+
- `script`, `editor-script`, `view-script`
|
|
482
|
+
- `style`, `editor-style`, `view-style`
|
|
483
|
+
- `script-module`, `view-script-module`
|
|
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)
|
|
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)
|
|
486
|
+
|
|
487
|
+
#### Notes
|
|
488
|
+
- In order to have a directory be treated as `extensions`, the config **must** include `directoryLayout: 'extensions'`
|
|
489
|
+
- Extensions **should** be created with `pnpm @plaudit/scaffold create extension`
|
|
490
|
+
|
|
491
|
+
#### Per-Entrypoint Options
|
|
492
|
+
The `extensions` entrypoint type doesn't have any.
|
|
493
|
+
|
|
494
|
+
### Plain
|
|
495
|
+
These entrypoints both support and need the largest amount of configuration. While all options will be listed here, the only one that you should need in sites is `locations`.
|
|
496
|
+
|
|
497
|
+
While `plain` entrypoints *can* be used for directory-based loading, that is a deprecated feature and **must not** be used in new projects
|
|
498
|
+
|
|
499
|
+
#### File Structure
|
|
500
|
+
Files in arbitrary subdirectories of src
|
|
501
|
+
```
|
|
502
|
+
src/
|
|
503
|
+
├── admin/
|
|
504
|
+
│ ├── editor.ts
|
|
505
|
+
│ └── editor.pcss
|
|
506
|
+
├── site/
|
|
507
|
+
│ ├── public.ts
|
|
508
|
+
│ └── public.pcss
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
#### Per-Entrypoint Options
|
|
512
|
+
| Option | Type | Default | Description |
|
|
513
|
+
|--------------------------|--------------------------------------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------|
|
|
514
|
+
| `locations` | `object \| string \| fn(string) => string` | - | Where/how to load the asset. See the [Locations Object](#the-locations-object) section below for how to use this |
|
|
515
|
+
| `additionalDependencies` | `string[]` | - | **[Advanced]** Used to specify additional assets that the entrypoint depends on by handle |
|
|
516
|
+
| `externalize` | `string[]` | - | **[Advanced]** Specifies the object path at which the exports of the entrypoint should be emitted. This is used for creating shared libraries |
|
|
517
|
+
| `withLegacyBlocksIn` | `string` | - | **[Legacy]** Used to load legacy blocks that predate our use of `block.json`. This should **never** be used on new sites. |
|
|
518
|
+
|
|
519
|
+
##### The Locations Object
|
|
520
|
+
**String-form**:
|
|
521
|
+
- Equivalent to `{handle: <value here>}`. See the Object-form section below for more information
|
|
522
|
+
|
|
523
|
+
**Function-form**:
|
|
524
|
+
- Equivalent to `{handle: <function here>}`. See the Object-form section below for more information
|
|
525
|
+
|
|
526
|
+
**Object-form**:
|
|
527
|
+
|
|
528
|
+
This is the form that *should* be used. It has two categories of keys: control flags and location identifiers. As such, they have been split out into two blocks
|
|
529
|
+
|
|
530
|
+
**Control Flags:**
|
|
531
|
+
|
|
532
|
+
| Key | Type | Default | Description |
|
|
533
|
+
|----------------------|--------------------------------------------------------------------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
534
|
+
| `handle` | `string \| fn(string) => string` | Auto | The handle by which the entrypoint will be referenced. The function form is passed the default handle for manual tweaking |
|
|
535
|
+
| `register` | `boolean \| number` | `true` | **[Advanced]** Whether the entrypoint should be registered at all or, if a number, the priority of the hook in which the registration will occur |
|
|
536
|
+
| `registerScriptArgs` | `boolean` \| `'lazy'` \| [`WordPressScriptArgs`](#wordpress-script-args) | Auto | The loading flags (strategy, in_footer, and fetchpriority) for the script.<br>'lazy' is an alias for `{strategy: 'defer', in_footer: true}` |
|
|
537
|
+
|
|
538
|
+
**Location Identifiers:**
|
|
539
|
+
|
|
540
|
+
All location identifiers can be either a `boolean` or `number`. If they are a number, it sets the priority for the hook that is used to *enqueue* the resulting asset
|
|
541
|
+
|
|
542
|
+
| Identifier | Hook | Purpose |
|
|
543
|
+
|----------------|-------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
544
|
+
| `clientView` | `wp_enqueue_scripts` | Enqueues the asset on every visitable webpage. Block- or extension-based registration should generally be preferred |
|
|
545
|
+
| `clientEditor` | `enqueue_block_editor_assets` | Enqueues the asset for use with the editor *shell*. Assets that should be used in the editor *content* must be enqueued manually (or be loaded by blocks) |
|
|
546
|
+
| `blockAssets` | `enqueue_block_assets` | Enqueues the asset everywhere that block assets are enqueued. This includes *both* visitable webpages *and* the editor *content* |
|
|
547
|
+
| `admin` | `admin_enqueue_scripts` | Enqueues the asset on every admin page; additionally supports `hook_name` mode (see below) |
|
|
548
|
+
| `login` | `login_enqueue_scripts` | Enqueues the asset on the login page |
|
|
549
|
+
| `analytics` | `plaudit_enqueue_analytics` | A special version of `clientView` that only fires if enqueuing analytics code is allowed. Requires the `Plaudit Analytics Integrations` plugin. |
|
|
550
|
+
| `customizer` | `customizer_enqueue_scripts` | **[Legacy]** Enqueues the asset on legacy customizer page. Don't use this one. |
|
|
551
|
+
|
|
552
|
+
**`hook_name` mode**
|
|
553
|
+
- Allows the "hook name" (while WordPress calls it "hook name", it's actually the admin page identifier) to be used as an additional qualifier on whether the asset gets enqueued.
|
|
554
|
+
- This is currently only supported for the `admin` location
|
|
555
|
+
|
|
556
|
+
## WordPress Types
|
|
557
|
+
### WordPress Script Args
|
|
558
|
+
**Boolean-form:**
|
|
559
|
+
|
|
560
|
+
If `true`, the script is emitted in the footer. Defaults to `false`.
|
|
561
|
+
|
|
562
|
+
**Object-form:**
|
|
563
|
+
|
|
564
|
+
| Option | Type | Default | Description |
|
|
565
|
+
|-----------------|-----------------------------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
566
|
+
| `strategy` | `'defer' \| 'async' \| undefined` | `undefined` | Allows the script loading to be delayed. See [WordPress' docs](https://developer.wordpress.org/reference/functions/wp_register_script/#delayed-script-loading) for more information |
|
|
567
|
+
| `in_footer` | `boolean \| undefined` | `false` | If `true`, enqueues the script at the end of the body. See [WordPress' docs](https://developer.wordpress.org/reference/functions/wp_register_script/#delayed-script-loading) for more information |
|
|
568
|
+
| `fetchpriority` | `'auto' \| 'low' \| 'high'` | `'auto'` | **[Advanced]** Allows direct control of the script's fetchpriority.<br>WordPress does not currently have documentation for this option |
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## Supported File Types
|
|
573
|
+
|
|
574
|
+
| Group | Extensions |
|
|
575
|
+
|---------------------------|------------------------------------------------------------|
|
|
576
|
+
| **JavaScript/TypeScript** | `.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.mts` |
|
|
577
|
+
| **Stylesheets** | `.css`, `.pcss` (PostCSS), `.scss`, `.sass` |
|
|
578
|
+
| **Assets** | `.svg`, `.png`, `.jpg`, `.webp`, `.woff`, `.woff2` |
|
|
579
|
+
| **Special** | `block.json`, `template.php`, `template.twig`, `setup.php` |
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
## Need Help?
|
|
584
|
+
|
|
585
|
+
1. Enable verbose logging: `verbose: true` in config
|
|
586
|
+
2. Check generated files in `dist/` folder
|
|
587
|
+
3. Look at config files: `dist/**/config.php`
|
|
588
|
+
4. Check `dist/unified-loader.php` for registered assets
|
|
589
|
+
5. Review the README.md for technical details
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Compilation, Compiler
|
|
1
|
+
import { Compilation, Compiler } from "webpack";
|
|
2
2
|
import { PseudoSemaphore } from "../utils/pseduo-semaphore";
|
|
3
3
|
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
4
|
-
import { type ParsedAssetJsonProvider } from "../shared";
|
|
4
|
+
import { type ParsedAssetJsonProvider, WebpackPlugin } from "../shared";
|
|
5
5
|
type TapWithAssetsJsonOptions = {
|
|
6
6
|
name?: string;
|
|
7
7
|
stage?: (typeof Compilation.PROCESS_ASSETS_STAGE_REPORT) | (typeof Compilation.PROCESS_ASSETS_STAGE_ANALYSE);
|
|
@@ -9,7 +9,7 @@ type TapWithAssetsJsonOptions = {
|
|
|
9
9
|
};
|
|
10
10
|
type TapWithAssetsJsonFn = Parameters<Compilation['hooks']['processAssets']['tapPromise']>[1];
|
|
11
11
|
type TapWithParsedAssetsJsonFn = (parsedAssetJsonProvider: ParsedAssetJsonProvider, assets: Parameters<TapWithAssetsJsonFn>[0]) => Promise<void> | void;
|
|
12
|
-
export declare abstract class AbstractBiPhasicGroupPlugin implements
|
|
12
|
+
export declare abstract class AbstractBiPhasicGroupPlugin implements WebpackPlugin {
|
|
13
13
|
protected readonly config: VerifiedPlauditWordpressWebpackConfig;
|
|
14
14
|
readonly group: string;
|
|
15
15
|
private readonly semaphores;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type WebpackPlugin } from "../shared";
|
|
1
2
|
import browserSync, { type BrowserSyncInstance } from "browser-sync";
|
|
2
|
-
import type { Compiler
|
|
3
|
+
import type { Compiler } from "webpack";
|
|
3
4
|
export type PluginOptions = {
|
|
4
5
|
reload: boolean;
|
|
5
6
|
name: string;
|
|
@@ -7,7 +8,7 @@ export type PluginOptions = {
|
|
|
7
8
|
injectCss: boolean;
|
|
8
9
|
middlewareBuilder?: (options: browserSync.Options) => browserSync.Options['middleware'];
|
|
9
10
|
};
|
|
10
|
-
export declare class BrowserSyncPlugin implements
|
|
11
|
+
export declare class BrowserSyncPlugin implements WebpackPlugin {
|
|
11
12
|
private static isBrowserSyncRunning;
|
|
12
13
|
private static browserSyncPluginOptions?;
|
|
13
14
|
private readonly pluginOptions;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Compiler
|
|
2
|
-
|
|
1
|
+
import type { Compiler } from "webpack";
|
|
2
|
+
import type { WebpackPlugin } from "../shared";
|
|
3
|
+
export declare class MiniCSSExtractPluginErrorCleaner implements WebpackPlugin {
|
|
3
4
|
apply(compiler: Compiler): void;
|
|
4
5
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Compiler
|
|
2
|
-
|
|
1
|
+
import type { Compiler } from "webpack";
|
|
2
|
+
import type { WebpackPlugin } from "../shared";
|
|
3
|
+
export declare class PackageConfigSanityChecker implements WebpackPlugin {
|
|
3
4
|
apply(compiler: Compiler): void;
|
|
4
5
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
2
|
-
import type { Compiler
|
|
3
|
-
|
|
2
|
+
import type { Compiler } from "webpack";
|
|
3
|
+
import type { WebpackPlugin } from "../shared";
|
|
4
|
+
export declare class VariablesJSMonitorPlugin implements WebpackPlugin {
|
|
4
5
|
private readonly config;
|
|
5
6
|
constructor(config: VerifiedPlauditWordpressWebpackConfig);
|
|
6
7
|
apply(compiler: Compiler): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type WebpackPlugin } from "../shared";
|
|
1
2
|
import { AbstractBiPhasicGroupAndEntryPlugin } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
|
-
import { type Compiler
|
|
3
|
-
export declare class WPMLConfigBuilderPlugin implements
|
|
3
|
+
import { type Compiler } from "webpack";
|
|
4
|
+
export declare class WPMLConfigBuilderPlugin implements WebpackPlugin {
|
|
4
5
|
private readonly destDir;
|
|
5
6
|
private readonly referencePlugin;
|
|
6
7
|
private static jsdomInstance?;
|
package/build/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PHPWriter } from "@plaudit/php-writer";
|
|
2
2
|
import type { Options as PostcssFunctionsOptions } from "postcss-functions";
|
|
3
|
-
import { AssetInfo, Compilation,
|
|
3
|
+
import { AssetInfo, Compilation, Configuration, Entrypoint, WebpackError, Compiler } from "webpack";
|
|
4
4
|
export type ParsedAssetsJson = Record<string, {
|
|
5
5
|
dependencies: string[];
|
|
6
6
|
version: string;
|
|
@@ -78,6 +78,9 @@ export declare const enum SourceType {
|
|
|
78
78
|
plain = "plain"
|
|
79
79
|
}
|
|
80
80
|
export declare function determineCurrentSourceType(dest: string | AdvancedOutputConfig, srcIsDirectory: boolean): SourceType;
|
|
81
|
+
export interface WebpackPlugin {
|
|
82
|
+
apply(compiler: Compiler): void;
|
|
83
|
+
}
|
|
81
84
|
export type ObjectIndividualExternalDepConfig = {
|
|
82
85
|
import?: string | [string, ...string[]];
|
|
83
86
|
handle: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "../plugins/AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
2
|
import type { AdditionalDependencyInjectorPlugin } from "../plugins/AdditionalDependencyInjectorPlugin";
|
|
3
|
-
import { EntrypointFields, PlauditWordpressWebpackConfig, BlockEntrypointInfo, VerifiedAdvancedOutputConfig, MinimumViableMetadata } from "../shared";
|
|
3
|
+
import { EntrypointFields, PlauditWordpressWebpackConfig, BlockEntrypointInfo, VerifiedAdvancedOutputConfig, MinimumViableMetadata, WebpackPlugin } from "../shared";
|
|
4
4
|
import type { Compiler, Configuration, DynamicEntryPlugin, WebpackPluginInstance } from "webpack";
|
|
5
5
|
import type WebpackRemoveEmptyScriptsPlugin from "webpack-remove-empty-scripts";
|
|
6
6
|
export type VerifiedPlauditWordpressWebpackConfig = Required<Omit<PlauditWordpressWebpackConfig, 'variables' | 'src' | 'externals'>> & {
|
|
@@ -8,7 +8,7 @@ export type VerifiedPlauditWordpressWebpackConfig = Required<Omit<PlauditWordpre
|
|
|
8
8
|
currentVariables: Record<string, any>;
|
|
9
9
|
} & Pick<PlauditWordpressWebpackConfig, 'externals'>;
|
|
10
10
|
export type CommonPluginConfig = {
|
|
11
|
-
plugins: (WebpackPluginInstance | ((this: Compiler, compiler: Compiler) => void))[];
|
|
11
|
+
plugins: (WebpackPluginInstance | WebpackPlugin | ((this: Compiler, compiler: Compiler) => void))[];
|
|
12
12
|
removeEmptyScriptsPlugin: WebpackRemoveEmptyScriptsPlugin;
|
|
13
13
|
makeAdditionalDependencyInjectorPlugin(referencePlugin: AbstractBiPhasicGroupAndEntryPlugin<any>): AdditionalDependencyInjectorPlugin;
|
|
14
14
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "2.84.
|
|
3
|
+
"version": "2.84.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"files": [
|
|
6
6
|
"/build",
|
|
7
7
|
"README.md",
|
|
8
8
|
"LICENSE.md",
|
|
9
|
-
"CHANGELOG.md"
|
|
9
|
+
"CHANGELOG.md",
|
|
10
|
+
"USER-GUIDE.md"
|
|
10
11
|
],
|
|
11
12
|
"exports": {
|
|
12
13
|
"./wordpress-scripts-wrapper": "./build/wordpress-scripts-wrapper.js",
|
|
@@ -23,12 +24,11 @@
|
|
|
23
24
|
}
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
|
-
"@plaudit/gutenberg-api-extensions": "^2.
|
|
27
|
+
"@plaudit/gutenberg-api-extensions": "^2.85.0",
|
|
27
28
|
"@types/browser-sync-webpack-plugin": "^2.2.5",
|
|
28
|
-
"@types/node": "^25.
|
|
29
|
+
"@types/node": "^25.2.3",
|
|
29
30
|
"@types/postcss-functions": "^4.0.4",
|
|
30
31
|
"@types/tapable": "^2.3.0",
|
|
31
|
-
"@types/webpack": "^5.28.5",
|
|
32
32
|
"@types/webpack-sources": "^3.2.3",
|
|
33
33
|
"postcss-load-config": "^4.0.2",
|
|
34
34
|
"postcss-loader": "^7.3.4",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"postcss-reporter": "^7.1.0",
|
|
64
64
|
"postcss-simple-vars": "^7.0.1",
|
|
65
65
|
"postcss-url": "^10.1.3",
|
|
66
|
-
"webpack": "^5.
|
|
66
|
+
"webpack": "^5.105.1",
|
|
67
67
|
"webpack-remove-empty-scripts": "^1.1.1",
|
|
68
68
|
"xml-formatter": "^3.6.7"
|
|
69
69
|
},
|