@plaudit/webpack-extensions 2.72.1 → 2.73.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.
|
@@ -88,17 +88,6 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
88
88
|
}
|
|
89
89
|
}, { priority, accountForAlreadyDoing: this.config.includePostInitFallback });
|
|
90
90
|
}
|
|
91
|
-
const sortedEditorStyleHandles = sortedStyleHandles
|
|
92
|
-
.filter(([_, { locations: { clientEditor }, type }]) => type === 'style' && (clientEditor || typeof clientEditor === 'number'))
|
|
93
|
-
.map(info => info[1]);
|
|
94
|
-
if (sortedEditorStyleHandles.length > 0) {
|
|
95
|
-
writer.linebreak();
|
|
96
|
-
const themePath = process.cwd();
|
|
97
|
-
for (const handleData of sortedEditorStyleHandles) {
|
|
98
|
-
const handlePath = node_path_1.default.relative(themePath, handleData.src);
|
|
99
|
-
writer.call("add_editor_style", [(0, shared_1.leadingSlashIt)(handlePath)]);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
91
|
}
|
|
103
92
|
PlainEntrypointsConfigFileGeneratorPlugin.appendEnqueuingHandleLists(writer, handleLists);
|
|
104
93
|
(0, shared_1.emitPHPWriterAsAsset)(writer, compilation, "plain-entrypoints-loader.php");
|
|
@@ -109,11 +98,6 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
109
98
|
handleLists.register.push({ handle, type, data, priority: typeof data.locations.register === 'number' ? data.locations.register : 10 });
|
|
110
99
|
}
|
|
111
100
|
for (const location of (0, shared_1.constantKeys)(shared_1.standardLocationNamesMeta)) {
|
|
112
|
-
if (location === 'clientEditor' && type === 'style') {
|
|
113
|
-
// We don't include editor styles in the handle list because editor styles are enqueued via a completely separate mechanism at runtime and, therefore,
|
|
114
|
-
// cannot be handled by the same code as every other enqueueable item
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
101
|
if (typeof data.locations[location] === 'number') {
|
|
118
102
|
handleLists[location].push({ handle, type, priority: data.locations[location] });
|
|
119
103
|
}
|
package/build/shared.d.ts
CHANGED
|
@@ -148,4 +148,5 @@ export declare function emitResolveBaseUriFunction(writer: PHPWriter): void;
|
|
|
148
148
|
export declare function getAssetsJson(compilation: Compilation): ParsedAssetsJson;
|
|
149
149
|
export declare function emitPHPWriterAsAsset(writer: PHPWriter, compilation: Compilation, file: string, assetInfo?: AssetInfo): void;
|
|
150
150
|
export declare function dedent(text: TemplateStringsArray): string;
|
|
151
|
+
export declare function resolveLegacyBlockScriptsInFolder(folder: string): string[];
|
|
151
152
|
export {};
|
package/build/shared.js
CHANGED
|
@@ -26,7 +26,10 @@ exports.emitResolveBaseUriFunction = emitResolveBaseUriFunction;
|
|
|
26
26
|
exports.getAssetsJson = getAssetsJson;
|
|
27
27
|
exports.emitPHPWriterAsAsset = emitPHPWriterAsAsset;
|
|
28
28
|
exports.dedent = dedent;
|
|
29
|
+
exports.resolveLegacyBlockScriptsInFolder = resolveLegacyBlockScriptsInFolder;
|
|
30
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
29
31
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
32
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
30
33
|
const php_writer_1 = require("@plaudit/php-writer");
|
|
31
34
|
const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
32
35
|
const webpack_1 = require("webpack");
|
|
@@ -192,3 +195,17 @@ function dedent(text) {
|
|
|
192
195
|
}
|
|
193
196
|
return actualText.replaceAll(new RegExp("^" + firstLineIndent, 'mg'), "").replace(/\n{2}$/, "\n");
|
|
194
197
|
}
|
|
198
|
+
function resolveLegacyBlockScriptsInFolder(folder) {
|
|
199
|
+
const blockScriptEntrypoints = [];
|
|
200
|
+
for (const blockDir of node_fs_1.default.readdirSync(folder)) {
|
|
201
|
+
const fullBlockDir = node_path_1.default.join(folder, blockDir);
|
|
202
|
+
const packageJSON = node_path_1.default.join(fullBlockDir, 'package.json');
|
|
203
|
+
if (node_fs_1.default.existsSync(packageJSON)) {
|
|
204
|
+
const main = JSON.parse(node_fs_1.default.readFileSync(packageJSON, 'utf8'))['main'];
|
|
205
|
+
if (main && node_fs_1.default.existsSync(node_path_1.default.join(fullBlockDir, main))) {
|
|
206
|
+
blockScriptEntrypoints.push(node_path_1.default.join(fullBlockDir, main));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return blockScriptEntrypoints;
|
|
211
|
+
}
|
|
@@ -25,20 +25,6 @@ const UnifiedLoaderGenerator_1 = require("./plugins/UnifiedLoaderGenerator");
|
|
|
25
25
|
const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
|
|
26
26
|
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
27
27
|
const webpack_remove_empty_scripts_1 = __importDefault(require("webpack-remove-empty-scripts"));
|
|
28
|
-
function resolveLegacyBlockScriptsInFolder(folder) {
|
|
29
|
-
const blockScriptEntrypoints = [];
|
|
30
|
-
for (const blockDir of node_fs_1.default.readdirSync(folder)) {
|
|
31
|
-
const fullBlockDir = node_path_1.default.join(folder, blockDir);
|
|
32
|
-
const packageJSON = node_path_1.default.join(fullBlockDir, 'package.json');
|
|
33
|
-
if (node_fs_1.default.existsSync(packageJSON)) {
|
|
34
|
-
const main = JSON.parse(node_fs_1.default.readFileSync(packageJSON, 'utf8'))['main'];
|
|
35
|
-
if (main && node_fs_1.default.existsSync(node_path_1.default.join(fullBlockDir, main))) {
|
|
36
|
-
blockScriptEntrypoints.push(node_path_1.default.join(fullBlockDir, main));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return blockScriptEntrypoints;
|
|
41
|
-
}
|
|
42
28
|
function testForDuplicatedEntryPaths(sources) {
|
|
43
29
|
const seenPaths = (0, common_config_helpers_1.groupEntrypointsByAssetFile)(Array.isArray(sources)
|
|
44
30
|
? sources.map(s => typeof s === 'string' ? s : s[1].destination)
|
|
@@ -466,7 +452,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources, canClean
|
|
|
466
452
|
const { processingModules, scriptExtension } = commonConfig;
|
|
467
453
|
const allSrcRoots = sources.map(([src, dest]) => {
|
|
468
454
|
const srcRoots = (dest.withLegacyBlocksIn
|
|
469
|
-
? [...src.split(','), ...resolveLegacyBlockScriptsInFolder(node_path_1.default.join(config.srcDir, dest.withLegacyBlocksIn))]
|
|
455
|
+
? [...src.split(','), ...(0, shared_1.resolveLegacyBlockScriptsInFolder)(node_path_1.default.join(config.srcDir, dest.withLegacyBlocksIn))]
|
|
470
456
|
: src.split(',')).filter(s => s.endsWith(".json") || !s.substring(s.lastIndexOf('/')).includes('.') || processingModules === shared_1.scriptWithModuleExtension.test(s));
|
|
471
457
|
const srcRoot = srcRoots.length < 2 ? (0, common_config_helpers_1.joinPossiblyAbsolutePaths)(process.cwd(), src) : srcRoots.map(s => (0, common_config_helpers_1.joinPossiblyAbsolutePaths)(process.cwd(), s));
|
|
472
458
|
const srcIsDirectory = !Array.isArray(srcRoot) && node_fs_1.default.lstatSync(srcRoot, { throwIfNoEntry: false })?.isDirectory();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.73.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"files": [
|
|
6
6
|
"/build"
|
|
@@ -20,21 +20,20 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@plaudit/gutenberg-api-extensions": "^2.
|
|
23
|
+
"@plaudit/gutenberg-api-extensions": "^2.79.0",
|
|
24
24
|
"@types/browser-sync-webpack-plugin": "^2.2.5",
|
|
25
|
-
"@types/node": "^24.
|
|
25
|
+
"@types/node": "^24.10.0",
|
|
26
26
|
"@types/postcss-functions": "^4.0.4",
|
|
27
27
|
"@types/tapable": "^2.3.0",
|
|
28
28
|
"@types/webpack": "^5.28.5",
|
|
29
29
|
"@types/webpack-sources": "^3.2.3",
|
|
30
30
|
"postcss-load-config": "^4.0.2",
|
|
31
31
|
"postcss-loader": "^7.3.4",
|
|
32
|
-
"ts-node": "^10.9.2",
|
|
33
32
|
"typescript": "^5.9.3",
|
|
34
33
|
"webpack-bundle-analyzer": "^4.10.2"
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
37
|
-
"@plaudit/php-writer": "^1.
|
|
36
|
+
"@plaudit/php-writer": "^1.3.1",
|
|
38
37
|
"@plaudit/postcss-color-function": "^5.0.0",
|
|
39
38
|
"@plaudit/postcss-legacy-shorthand": "^1.0.0",
|
|
40
39
|
"@plaudit/postcss-silent-extend": "^3.0.0",
|
|
@@ -42,9 +41,9 @@
|
|
|
42
41
|
"@plaudit/postcss-variables": "^1.1.0",
|
|
43
42
|
"@wordpress/dependency-extraction-webpack-plugin": "^6.34.0",
|
|
44
43
|
"@wordpress/scripts": "^30.27.0",
|
|
45
|
-
"autoprefixer": "^10.4.
|
|
44
|
+
"autoprefixer": "^10.4.22",
|
|
46
45
|
"browser-sync": "^3.0.4",
|
|
47
|
-
"copy-webpack-plugin": "
|
|
46
|
+
"copy-webpack-plugin": "10.2.4",
|
|
48
47
|
"cssnano": "^6.1.2",
|
|
49
48
|
"eslint-plugin-jsdoc": "^48.11.0",
|
|
50
49
|
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
|
@@ -62,8 +61,6 @@
|
|
|
62
61
|
"postcss-reporter": "^7.1.0",
|
|
63
62
|
"postcss-simple-vars": "^7.0.1",
|
|
64
63
|
"postcss-url": "^10.1.3",
|
|
65
|
-
"react": "^18.3.1",
|
|
66
|
-
"react-dom": "^18.3.1",
|
|
67
64
|
"webpack": "^5.102.1",
|
|
68
65
|
"webpack-remove-empty-scripts": "^1.1.1",
|
|
69
66
|
"xml-formatter": "^3.6.7"
|