@plaudit/webpack-extensions 3.6.1 → 3.6.3
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,16 @@ 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.6.3] - 2026-04-27
|
|
9
|
+
### Fixed
|
|
10
|
+
- An `ENOENT` error when the `srcDir` does not map to an actual directory on disk
|
|
11
|
+
- It now matches the behavior of manually-declared sources and exits due to not having anything to build
|
|
12
|
+
- This comes from version `2.89.2`
|
|
13
|
+
|
|
14
|
+
## [3.6.2] - 2026-04-09
|
|
15
|
+
### Changed
|
|
16
|
+
- The error message for multiple render files to include instructions for solving it
|
|
17
|
+
|
|
8
18
|
## [3.6.1] - 2026-04-06
|
|
9
19
|
### Fixed
|
|
10
20
|
- The emitter for the Extensions v1 format including an extra path element
|
|
@@ -102,6 +112,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
102
112
|
- Legacy PostCSS features that have been integrated into modern CSS
|
|
103
113
|
- `@extends` support
|
|
104
114
|
|
|
115
|
+
## [2.89.2] - 2026-04-27
|
|
116
|
+
### Fixed
|
|
117
|
+
- An `ENOENT` error when the `srcDir` does not map to an actual directory on disk
|
|
118
|
+
- It now matches the behavior of manually-declared sources and exits due to not having anything to build
|
|
119
|
+
|
|
105
120
|
## [2.89.1] - 2026-04-06
|
|
106
121
|
### Fixed
|
|
107
122
|
- The emitter for the Extensions v1 format including an extra path element
|
|
@@ -412,7 +412,7 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
412
412
|
}
|
|
413
413
|
delete blockJson[invalidTemplateLocation];
|
|
414
414
|
if (renderTemplate.length > 1) {
|
|
415
|
-
compilation.warnings.push((0, shared_1.newWebpackErrorForFile)("Encountered a block with multiple possible render files", (0, node_path_1.join)(sourceDir, 'block.json')));
|
|
415
|
+
compilation.warnings.push((0, shared_1.newWebpackErrorForFile)("Encountered a block with multiple possible render files. Please set the render key in block.json to the proper one", (0, node_path_1.join)(sourceDir, 'block.json')));
|
|
416
416
|
blockJson[validTemplateLocation] = renderTemplate.find(p => p.endsWith(".php")) ?? renderTemplate[0];
|
|
417
417
|
}
|
|
418
418
|
else {
|
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.6.
|
|
3
|
+
"version": "3.6.3",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"files": [
|
|
6
6
|
"/dist",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@plaudit/gutenberg-api-extensions": "^2.
|
|
31
|
+
"@plaudit/gutenberg-api-extensions": "^2.94.1",
|
|
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": {
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"@plaudit/postcss-color-function": "^5.0.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.44.0",
|
|
47
|
+
"@wordpress/scripts": "^32.0.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.7",
|
|
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.12",
|
|
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.
|
|
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",
|