@plaudit/webpack-extensions 3.6.2 → 3.7.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
CHANGED
|
@@ -5,6 +5,17 @@ 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.7.0] - 2026-05-04
|
|
9
|
+
### Added
|
|
10
|
+
- PNPM 11 compatibility
|
|
11
|
+
- This comes from version `2.90.0`
|
|
12
|
+
|
|
13
|
+
## [3.6.3] - 2026-04-27
|
|
14
|
+
### Fixed
|
|
15
|
+
- An `ENOENT` error when the `srcDir` does not map to an actual directory on disk
|
|
16
|
+
- It now matches the behavior of manually-declared sources and exits due to not having anything to build
|
|
17
|
+
- This comes from version `2.89.2`
|
|
18
|
+
|
|
8
19
|
## [3.6.2] - 2026-04-09
|
|
9
20
|
### Changed
|
|
10
21
|
- The error message for multiple render files to include instructions for solving it
|
|
@@ -106,6 +117,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
106
117
|
- Legacy PostCSS features that have been integrated into modern CSS
|
|
107
118
|
- `@extends` support
|
|
108
119
|
|
|
120
|
+
## [2.90.0] - 2026-05-04
|
|
121
|
+
### Added
|
|
122
|
+
- PNPM 11 compatibility
|
|
123
|
+
|
|
124
|
+
## [2.89.2] - 2026-04-27
|
|
125
|
+
### Fixed
|
|
126
|
+
- An `ENOENT` error when the `srcDir` does not map to an actual directory on disk
|
|
127
|
+
- It now matches the behavior of manually-declared sources and exits due to not having anything to build
|
|
128
|
+
|
|
109
129
|
## [2.89.1] - 2026-04-06
|
|
110
130
|
### Fixed
|
|
111
131
|
- The emitter for the Extensions v1 format including an extra path element
|
|
@@ -1,41 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.ExtensionsConfigFileGeneratorPlugin = void 0;
|
|
37
4
|
const promises_1 = require("node:fs/promises");
|
|
38
|
-
const node_path_1 =
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
39
6
|
const php_writer_1 = require("@plaudit/php-writer");
|
|
40
7
|
const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
41
8
|
const AbstractBiPhasicGroupAndEntryPlugin_1 = require("./AbstractBiPhasicGroupAndEntryPlugin");
|
|
@@ -66,10 +33,10 @@ class ExtensionsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryP
|
|
|
66
33
|
const emissionPromises = [];
|
|
67
34
|
for await (const { name: setupFilePath } of await (0, promises_1.opendir)(this.extensionsSrcPath, { encoding: 'utf-8' })) {
|
|
68
35
|
if (setupFilePath.endsWith("-setup.php")) {
|
|
69
|
-
const setupFileSourcePath = node_path_1.
|
|
36
|
+
const setupFileSourcePath = (0, node_path_1.join)(this.extensionsSrcPath, setupFilePath);
|
|
70
37
|
compilation.fileDependencies.add(setupFileSourcePath);
|
|
71
38
|
emissionPromises.push((0, promises_1.readFile)(setupFileSourcePath).then(contents => {
|
|
72
|
-
compilation.emitAsset(node_path_1.
|
|
39
|
+
compilation.emitAsset((0, node_path_1.join)(this.dest.destination, setupFilePath), new webpack_1.sources.RawSource(contents), { size: Buffer.byteLength(contents) });
|
|
73
40
|
const blockSlug = /^(.+?)-setup.php$/i.exec(setupFilePath)?.[1];
|
|
74
41
|
return [blockSlug, setupFilePath];
|
|
75
42
|
}));
|
|
@@ -91,10 +58,10 @@ class ExtensionsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryP
|
|
|
91
58
|
if (dirent.isFile()) {
|
|
92
59
|
if (dirent.name === "setup.php") {
|
|
93
60
|
const setupFilePath = (0, node_path_1.join)(...parents, dirent.name);
|
|
94
|
-
const setupFileSourcePath = node_path_1.
|
|
61
|
+
const setupFileSourcePath = (0, node_path_1.join)(this.extensionsSrcPath, setupFilePath);
|
|
95
62
|
compilation.fileDependencies.add(setupFileSourcePath);
|
|
96
63
|
emissionPromises.push((0, promises_1.readFile)(setupFileSourcePath).then(contents => {
|
|
97
|
-
compilation.emitAsset(node_path_1.
|
|
64
|
+
compilation.emitAsset((0, node_path_1.join)(this.dest.destination, setupFilePath), new webpack_1.sources.RawSource(contents), { size: Buffer.byteLength(contents) });
|
|
98
65
|
return [parents.join("-") /* blockSlug */, setupFilePath];
|
|
99
66
|
}));
|
|
100
67
|
}
|
|
@@ -156,7 +123,7 @@ class ExtensionsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryP
|
|
|
156
123
|
.toSorted(([a], [b]) => a.localeCompare(b)));
|
|
157
124
|
(0, shared_1.emitPHPWriterAsAsset)(new php_writer_1.PHPWriter()
|
|
158
125
|
.call("Plaudit\\Common\\Lib\\GutenbergUtils::loadExtensionsV3", [new expressions_1.EnclosedLiteral((0, shared_1.makeEmittableConfigPHP)(blockExtensionsConfig, false)), expressions_1.Op.concat(expressions_1.Constants.__DIR__, '/'),
|
|
159
|
-
expressions_1.Expr.call("plaudit_webpack_extensions__resolve_base_uri", [expressions_1.Constants.__DIR__])]), compilation, node_path_1.
|
|
126
|
+
expressions_1.Expr.call("plaudit_webpack_extensions__resolve_base_uri", [expressions_1.Constants.__DIR__])]), compilation, (0, node_path_1.join)(this.dest.destination, "extensions-loader.php"));
|
|
160
127
|
}
|
|
161
128
|
attachUniquePhase(compilation) {
|
|
162
129
|
compilation.hooks.processAssets.tapPromise({ name: this.constructor.name, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_REPORT }, async () => {
|
package/dist/shared.d.ts
CHANGED
|
@@ -249,3 +249,10 @@ export declare function resolveLegacyBlockScriptsInFolder(folder: string): strin
|
|
|
249
249
|
* @param file something that represents the file that is being inlined (this is purely for error-reporting purposes)
|
|
250
250
|
*/
|
|
251
251
|
export declare function appendAddInlineAssetCall(compilation: Compilation, writer: PHPWriter, handle: string, type: 'script' | 'style' | 'script_module', inlinedAsset: InlinedAsset, handleData: HandleData, file: string): void;
|
|
252
|
+
export declare function synchronousDirIterator(dirPath: string): Generator<import("node:fs").Dirent<string>, void, unknown>;
|
|
253
|
+
/**
|
|
254
|
+
* A type-guarded version of `instanceof Error` for Node.js.
|
|
255
|
+
* @author Joseph JDBar Barron
|
|
256
|
+
* @link https://dev.to/jdbar
|
|
257
|
+
*/
|
|
258
|
+
export declare function instanceOfNodeError<T extends new (...args: any) => Error>(value: unknown, errorType: T): value is InstanceType<T> & NodeJS.ErrnoException;
|
package/dist/shared.js
CHANGED
|
@@ -49,9 +49,11 @@ exports.emitPHPWriterAsAsset = emitPHPWriterAsAsset;
|
|
|
49
49
|
exports.dedent = dedent;
|
|
50
50
|
exports.resolveLegacyBlockScriptsInFolder = resolveLegacyBlockScriptsInFolder;
|
|
51
51
|
exports.appendAddInlineAssetCall = appendAddInlineAssetCall;
|
|
52
|
+
exports.synchronousDirIterator = synchronousDirIterator;
|
|
53
|
+
exports.instanceOfNodeError = instanceOfNodeError;
|
|
52
54
|
const node_crypto_1 = require("node:crypto");
|
|
53
|
-
const node_fs_1 =
|
|
54
|
-
const promises_1 =
|
|
55
|
+
const node_fs_1 = require("node:fs");
|
|
56
|
+
const promises_1 = require("node:fs/promises");
|
|
55
57
|
const node_path_1 = __importDefault(require("node:path"));
|
|
56
58
|
const php_writer_1 = require("@plaudit/php-writer");
|
|
57
59
|
const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
@@ -192,7 +194,7 @@ function kebabCase(value) {
|
|
|
192
194
|
return kebabCaseRegexes.reduce((str, [pattern, replacement]) => str.replace(pattern, replacement), value).toLowerCase();
|
|
193
195
|
}
|
|
194
196
|
async function loadEnvFile(filePath) {
|
|
195
|
-
return promises_1.
|
|
197
|
+
return (0, promises_1.readFile)(filePath, 'utf-8').then(parseEnvFile, () => ({}));
|
|
196
198
|
}
|
|
197
199
|
function parseEnvFile(contents) {
|
|
198
200
|
return Object.fromEntries(contents.split(/(\r?\n)+/).map(line => line.trim())
|
|
@@ -299,12 +301,12 @@ function dedent(text) {
|
|
|
299
301
|
}
|
|
300
302
|
function resolveLegacyBlockScriptsInFolder(folder) {
|
|
301
303
|
const blockScriptEntrypoints = [];
|
|
302
|
-
for (const blockDir of node_fs_1.
|
|
304
|
+
for (const blockDir of (0, node_fs_1.readdirSync)(folder)) {
|
|
303
305
|
const fullBlockDir = node_path_1.default.join(folder, blockDir);
|
|
304
306
|
const packageJSON = node_path_1.default.join(fullBlockDir, 'package.json');
|
|
305
|
-
if (node_fs_1.
|
|
306
|
-
const main = JSON.parse(node_fs_1.
|
|
307
|
-
if (main && node_fs_1.
|
|
307
|
+
if ((0, node_fs_1.existsSync)(packageJSON)) {
|
|
308
|
+
const main = JSON.parse((0, node_fs_1.readFileSync)(packageJSON, 'utf8'))['main'];
|
|
309
|
+
if (main && (0, node_fs_1.existsSync)(node_path_1.default.join(fullBlockDir, main))) {
|
|
308
310
|
blockScriptEntrypoints.push(node_path_1.default.join(fullBlockDir, main));
|
|
309
311
|
}
|
|
310
312
|
}
|
|
@@ -340,3 +342,24 @@ function appendAddInlineAssetCall(compilation, writer, handle, type, inlinedAsse
|
|
|
340
342
|
}
|
|
341
343
|
writer.call(`wp_add_inline_${type}`, args);
|
|
342
344
|
}
|
|
345
|
+
function* synchronousDirIterator(dirPath) {
|
|
346
|
+
try {
|
|
347
|
+
using dir = (0, node_fs_1.opendirSync)(dirPath);
|
|
348
|
+
for (let dirent; (dirent = dir.readSync()) !== null;) {
|
|
349
|
+
yield dirent;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
catch (e) {
|
|
353
|
+
if (!instanceOfNodeError(e, Error) || e.code !== 'ENOENT') {
|
|
354
|
+
throw e;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* A type-guarded version of `instanceof Error` for Node.js.
|
|
360
|
+
* @author Joseph JDBar Barron
|
|
361
|
+
* @link https://dev.to/jdbar
|
|
362
|
+
*/
|
|
363
|
+
function instanceOfNodeError(value, errorType) {
|
|
364
|
+
return !!value && value instanceof errorType;
|
|
365
|
+
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isSourceType = isSourceType;
|
|
4
4
|
exports.resolveAllConfigLevelEntrypoints = resolveAllConfigLevelEntrypoints;
|
|
5
|
-
const node_fs_1 = require("node:fs");
|
|
6
5
|
const node_path_1 = require("node:path");
|
|
7
6
|
const location_encoding_filename_parser_1 = require("./location-encoding-filename-parser");
|
|
8
7
|
const path_query_and_related_helpers_1 = require("./path-query-and-related-helpers");
|
|
8
|
+
const shared_1 = require("../shared");
|
|
9
9
|
function isSourceType(str) {
|
|
10
10
|
return str === "blocks" /* SourceType.blocks */ || str === "extensions" /* SourceType.extensions */ || str === "plain" /* SourceType.plain */;
|
|
11
11
|
}
|
|
@@ -38,8 +38,7 @@ function resolveAllConfigLevelEntrypoints(config, projectRoot = process.cwd()) {
|
|
|
38
38
|
const dynamicallyIncludedEntrypoints = [];
|
|
39
39
|
if (srcDir) { // This will only work if we have a unified src root
|
|
40
40
|
const dynamicallyIncludedEntrypointsRoot = (0, node_path_1.isAbsolute)(srcDir) ? srcDir : (0, node_path_1.join)(projectRoot, srcDir);
|
|
41
|
-
|
|
42
|
-
for (let dirent; (dirent = dir.readSync()) !== null;) {
|
|
41
|
+
for (const dirent of (0, shared_1.synchronousDirIterator)(dynamicallyIncludedEntrypointsRoot)) {
|
|
43
42
|
if (dirent.name in configSrc || `./${dirent.name}` in configSrc) {
|
|
44
43
|
continue;
|
|
45
44
|
}
|
|
@@ -49,8 +48,7 @@ function resolveAllConfigLevelEntrypoints(config, projectRoot = process.cwd()) {
|
|
|
49
48
|
dynamicallyIncludedEntrypoints.push([dirent.name, { directoryLayout: dirent.name }]);
|
|
50
49
|
continue;
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
for (let nestedDirent; (nestedDirent = nestedDir.readSync()) !== null;) {
|
|
51
|
+
for (const nestedDirent of (0, shared_1.synchronousDirIterator)((0, node_path_1.join)(dynamicallyIncludedEntrypointsRoot, dirent.name))) {
|
|
54
52
|
if (!nestedDirent.isFile()) {
|
|
55
53
|
continue;
|
|
56
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"files": [
|
|
6
6
|
"/dist",
|
|
@@ -28,32 +28,32 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@plaudit/gutenberg-api-extensions": "^2.
|
|
31
|
+
"@plaudit/gutenberg-api-extensions": "^2.97.0",
|
|
32
32
|
"@types/browser-sync-webpack-plugin": "^2.2.5",
|
|
33
|
-
"@types/node": "^25.
|
|
33
|
+
"@types/node": "^25.6.0",
|
|
34
34
|
"@types/postcss-functions": "^4.0.4",
|
|
35
35
|
"@types/postcss-import": "^14.0.3",
|
|
36
36
|
"@types/tapable": "^2.3.0",
|
|
37
37
|
"@types/webpack-sources": "^3.2.3",
|
|
38
|
-
"typescript": "^6.0.
|
|
38
|
+
"typescript": "^6.0.3",
|
|
39
39
|
"webpack-bundle-analyzer": "^5.3.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@plaudit/php-writer": "^1.4.1",
|
|
43
|
-
"@plaudit/postcss-color-function": "^5.
|
|
43
|
+
"@plaudit/postcss-color-function": "^5.1.0",
|
|
44
44
|
"@plaudit/postcss-strip-units": "^3.0.0",
|
|
45
45
|
"@plaudit/postcss-variables": "^2.0.1",
|
|
46
|
-
"@wordpress/dependency-extraction-webpack-plugin": "^6.
|
|
47
|
-
"@wordpress/scripts": "^
|
|
48
|
-
"autoprefixer": "^10.
|
|
46
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^6.45.0",
|
|
47
|
+
"@wordpress/scripts": "^32.1.0",
|
|
48
|
+
"autoprefixer": "^10.5.0",
|
|
49
49
|
"browser-sync": "^3.0.4",
|
|
50
50
|
"copy-webpack-plugin": "10.2.4",
|
|
51
51
|
"css-minimizer-webpack-plugin": "^8.0.0",
|
|
52
|
-
"cssnano": "^7.1.
|
|
52
|
+
"cssnano": "^7.1.8",
|
|
53
53
|
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
|
54
54
|
"http-proxy-middleware": "^3.0.5",
|
|
55
55
|
"json2php": "^0.0.12",
|
|
56
|
-
"postcss": "^8.5.
|
|
56
|
+
"postcss": "^8.5.13",
|
|
57
57
|
"postcss-calc": "^10.1.1",
|
|
58
58
|
"postcss-functions": "^4.0.2",
|
|
59
59
|
"postcss-import": "^16.1.1",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"postcss-property-lookup": "^3.0.0",
|
|
64
64
|
"postcss-reporter": "^7.1.0",
|
|
65
65
|
"postcss-url": "^10.1.3",
|
|
66
|
-
"webpack": "^5.106.
|
|
66
|
+
"webpack": "^5.106.2",
|
|
67
67
|
"webpack-remove-empty-scripts": "^1.1.1",
|
|
68
68
|
"xml-formatter": "^3.7.0"
|
|
69
69
|
},
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"node": ">=20"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
|
+
"pnpm:devPreinstall": "pnpm add --config '@plaudit/pnpm-plugin-plaudit-config'",
|
|
74
75
|
"build": "tsc",
|
|
75
76
|
"clean": "rm -rf dist",
|
|
76
77
|
"build:clean": "pnpm run clean && pnpm run build",
|