@plaudit/webpack-extensions 2.94.1 → 2.95.0
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 +6 -0
- package/USER-GUIDE.md +16 -11
- package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.js +1 -1
- package/dist/shared.d.ts +4 -0
- package/dist/shared.js +7 -0
- package/dist/utils/common-config-helpers.js +1 -1
- package/dist/utils/location-encoding-filename-parser.js +1 -1
- package/dist/wordpress-scripts-wrapper.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -60,6 +60,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
60
60
|
- Legacy PostCSS features that have been integrated into modern CSS
|
|
61
61
|
- `@extends` support
|
|
62
62
|
|
|
63
|
+
## [2.95.0] - 2026-08-04
|
|
64
|
+
### Added
|
|
65
|
+
- Logic so that files and directories with names equal to "example" or "examples" or that include "example" as a name segment are skipped
|
|
66
|
+
- This is done to allow us to include example files
|
|
67
|
+
- Updated the user guide with this information
|
|
68
|
+
|
|
63
69
|
## [2.94.1] - 2026-07-20
|
|
64
70
|
### Fixed
|
|
65
71
|
- A bug that caused all styles bound for editor use to be emitted as inline CSS
|
package/USER-GUIDE.md
CHANGED
|
@@ -104,7 +104,7 @@ However, if you need to do something unusual or just want to know what everythin
|
|
|
104
104
|
- Any time that `dist` is referenced in a path, it should be replaced with the value of `outputDir` in your WebPack file
|
|
105
105
|
- As with `src`, the value of `outputDir` *should be* `dist`; however, this might not be the case in some inherited or older code
|
|
106
106
|
- 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
|
|
107
|
-
- Paths in values in the `src`
|
|
107
|
+
- 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
|
|
108
108
|
- 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)
|
|
109
109
|
|
|
110
110
|
### Examples
|
|
@@ -117,6 +117,10 @@ However, if you need to do something unusual or just want to know what everythin
|
|
|
117
117
|
- All folder and file names should be in kebab-case
|
|
118
118
|
- 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`)
|
|
119
119
|
|
|
120
|
+
### Enforced Naming Conventions
|
|
121
|
+
- Directory and file names that start with a "~" are interpreted as "backup code" and are, therefore, not built.
|
|
122
|
+
- File and directory names that are equal to "example" or "examples", or have "example" as a name segment (see [Location-Encoding Filenames](#location-encoding-filenames) for details on what a name-segment is) are treated as example code and are also not built
|
|
123
|
+
|
|
120
124
|
### Blocks
|
|
121
125
|
- Block folder names *should* match the local portion of their name (ex: `plaudit-query-loop-maps/address-wrapper` should be stored in `address-wrapper`)
|
|
122
126
|
|
|
@@ -354,16 +358,17 @@ Notes on how to read the following table:
|
|
|
354
358
|
- `(-|=)` means "this can be either a dash or an equal sign"
|
|
355
359
|
- Pipe-separated items in parentheses means "any one of these items can go here"
|
|
356
360
|
|
|
357
|
-
| Name
|
|
358
|
-
|
|
359
|
-
| Enqueuing Location
|
|
360
|
-
| Type Override
|
|
361
|
-
| Inline
|
|
362
|
-
| Strategy
|
|
363
|
-
| Fetch Priority
|
|
364
|
-
| In Footer
|
|
365
|
-
| In Header
|
|
366
|
-
| Extension
|
|
361
|
+
| Name | Token | Usage |
|
|
362
|
+
|---------------------|-------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
363
|
+
| 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 |
|
|
364
|
+
| 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)` |
|
|
365
|
+
| Inline | `inline[(-\|=)position]`, `strategy(-\|=)inline[-position]` | Indicates that the script should be inlined. `position` can be either `before` or `after` |
|
|
366
|
+
| 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` |
|
|
367
|
+
| Fetch Priority | `fetchpriority(-\|=)(low\|high\|auto)` | Controls the fetchpriority property; `auto` is the default |
|
|
368
|
+
| In Footer | `in-footer`, `in_footer` | Sets the `in_footer` value to `true`; incompatible with `in-header` |
|
|
369
|
+
| In Header | `in-header`, `in_header` | Sets the `in_footer` value to `false`; incompatible with `in-footer` |
|
|
370
|
+
| 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) |
|
|
371
|
+
| Example Code Marker | `example` | This informs the build system that the file contains example code and, therefore, should not be build |
|
|
367
372
|
|
|
368
373
|
### Enqueuing Location
|
|
369
374
|
If this is the first token, it can be suffixed with `-script`, `-style`, or `-script-module` to override the type.
|
|
@@ -52,7 +52,7 @@ class ExtensionsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryP
|
|
|
52
52
|
compilation.contextDependencies.add(srcRoot);
|
|
53
53
|
}
|
|
54
54
|
for await (const dirent of await (0, promises_1.opendir)(srcRoot)) {
|
|
55
|
-
if (dirent.name
|
|
55
|
+
if ((0, shared_1.shouldBeSkipped)(dirent.name)) {
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
58
58
|
if (dirent.isFile()) {
|
package/dist/shared.d.ts
CHANGED
|
@@ -272,3 +272,7 @@ export declare function synchronousDirIterator(dirPath: string): Generator<impor
|
|
|
272
272
|
* @link https://dev.to/jdbar
|
|
273
273
|
*/
|
|
274
274
|
export declare function instanceOfNodeError<T extends new (...args: any) => Error>(value: unknown, errorType: T): value is InstanceType<T> & NodeJS.ErrnoException;
|
|
275
|
+
/**
|
|
276
|
+
* This tests if the name starts with a "~", is equal to "example" or "examples", or includes "example" as a name segment
|
|
277
|
+
*/
|
|
278
|
+
export declare function shouldBeSkipped(name: string): boolean;
|
package/dist/shared.js
CHANGED
|
@@ -53,6 +53,7 @@ exports.appendAddInlineAssetCall = appendAddInlineAssetCall;
|
|
|
53
53
|
exports.wrapInlineAssetContents = wrapInlineAssetContents;
|
|
54
54
|
exports.synchronousDirIterator = synchronousDirIterator;
|
|
55
55
|
exports.instanceOfNodeError = instanceOfNodeError;
|
|
56
|
+
exports.shouldBeSkipped = shouldBeSkipped;
|
|
56
57
|
const node_crypto_1 = require("node:crypto");
|
|
57
58
|
const node_fs_1 = require("node:fs");
|
|
58
59
|
const promises_1 = require("node:fs/promises");
|
|
@@ -390,3 +391,9 @@ function* synchronousDirIterator(dirPath) {
|
|
|
390
391
|
function instanceOfNodeError(value, errorType) {
|
|
391
392
|
return !!value && value instanceof errorType;
|
|
392
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* This tests if the name starts with a "~", is equal to "example" or "examples", or includes "example" as a name segment
|
|
396
|
+
*/
|
|
397
|
+
function shouldBeSkipped(name) {
|
|
398
|
+
return name.startsWith("~") || name === "example" || name === "examples" || name.startsWith("example.") || name.includes(".example.");
|
|
399
|
+
}
|
|
@@ -126,7 +126,7 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
126
126
|
const seenExplicitHandles = { scriptHandles: {}, styleHandles: {}, scriptModuleHandles: {} };
|
|
127
127
|
const loadingEntrypoints = [];
|
|
128
128
|
for await (const dirent of await (0, promises_1.opendir)(srcRoot)) {
|
|
129
|
-
if (!dirent.isDirectory() || dirent.name
|
|
129
|
+
if (!dirent.isDirectory() || (0, shared_1.shouldBeSkipped)(dirent.name)) {
|
|
130
130
|
continue;
|
|
131
131
|
}
|
|
132
132
|
const dir = joinPossiblyAbsolutePaths(srcRoot, dirent.name);
|
|
@@ -7,7 +7,7 @@ const node_path_1 = require("node:path");
|
|
|
7
7
|
const shared_1 = require("../shared");
|
|
8
8
|
function parseLocationEncodingFilename(filename) {
|
|
9
9
|
const { name, ext } = (0, node_path_1.parse)(filename);
|
|
10
|
-
if (
|
|
10
|
+
if ((0, shared_1.shouldBeSkipped)(name)) {
|
|
11
11
|
return undefined;
|
|
12
12
|
}
|
|
13
13
|
let type = /^\.(?:s[ac]|p?c)ss$/i.test(ext) ? 'style' : /^\.m[jt]sx?/i.test(ext) ? 'script-module' : /^\.[jt]sx?/i.test(ext) ? 'script' : false;
|
|
@@ -510,7 +510,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources, canClean
|
|
|
510
510
|
const entry = async () => {
|
|
511
511
|
const rawEntrypoints = [];
|
|
512
512
|
for await (const dirent of await (0, promises_1.opendir)(srcRoot)) {
|
|
513
|
-
if (dirent.name
|
|
513
|
+
if ((0, shared_1.shouldBeSkipped)(dirent.name)) {
|
|
514
514
|
continue;
|
|
515
515
|
}
|
|
516
516
|
if (dirent.isFile()) {
|
|
@@ -578,7 +578,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources, canClean
|
|
|
578
578
|
async function walkExtensionsTree(srcRoot, dest, applicableExtensionTest, parents) {
|
|
579
579
|
const res = [];
|
|
580
580
|
for await (const dirent of await (0, promises_1.opendir)(srcRoot)) {
|
|
581
|
-
if (dirent.name
|
|
581
|
+
if ((0, shared_1.shouldBeSkipped)(dirent.name)) {
|
|
582
582
|
continue;
|
|
583
583
|
}
|
|
584
584
|
if (dirent.isFile()) {
|