@plaudit/webpack-extensions 2.72.0 → 2.72.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/build/shared.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ export declare const scriptExtension: RegExp;
|
|
|
129
129
|
export declare const scriptWithoutModuleExtension: RegExp;
|
|
130
130
|
export declare const scriptWithModuleExtension: RegExp;
|
|
131
131
|
export declare const styleExtension: RegExp;
|
|
132
|
-
export declare function scriptOrStyleTest(entryPath: string, scriptExtension: RegExp): "" | "
|
|
132
|
+
export declare function scriptOrStyleTest(entryPath: string, scriptExtension: RegExp): "style" | "script" | "";
|
|
133
133
|
export declare function isStyleField(field: string): field is 'style' | 'viewStyle' | 'editorStyle';
|
|
134
134
|
export declare function isScriptModuleField(field: string): field is 'scriptModule' | 'viewScriptModule';
|
|
135
135
|
export declare function getHandleGroup(field: string): 'styleHandles' | 'scriptHandles' | 'scriptModuleHandles';
|
|
@@ -147,4 +147,5 @@ export declare function newWebpackErrorForFile(error: string | ConstructorParame
|
|
|
147
147
|
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
|
+
export declare function dedent(text: TemplateStringsArray): string;
|
|
150
151
|
export {};
|
package/build/shared.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.newWebpackErrorForFile = newWebpackErrorForFile;
|
|
|
25
25
|
exports.emitResolveBaseUriFunction = emitResolveBaseUriFunction;
|
|
26
26
|
exports.getAssetsJson = getAssetsJson;
|
|
27
27
|
exports.emitPHPWriterAsAsset = emitPHPWriterAsAsset;
|
|
28
|
+
exports.dedent = dedent;
|
|
28
29
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
29
30
|
const php_writer_1 = require("@plaudit/php-writer");
|
|
30
31
|
const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
@@ -183,3 +184,11 @@ function emitPHPWriterAsAsset(writer, compilation, file, assetInfo) {
|
|
|
183
184
|
const contents = writer.toString() + "\n";
|
|
184
185
|
compilation[file in compilation.assets ? 'updateAsset' : 'emitAsset'](file, new webpack_1.sources.RawSource(contents), { size: Buffer.byteLength(contents), ...assetInfo });
|
|
185
186
|
}
|
|
187
|
+
function dedent(text) {
|
|
188
|
+
const actualText = text.join("\n");
|
|
189
|
+
const firstLineIndent = actualText.split("\r?\n").find(line => line.length > 0)?.match(/^\s+/)?.[0];
|
|
190
|
+
if (!firstLineIndent) {
|
|
191
|
+
return actualText;
|
|
192
|
+
}
|
|
193
|
+
return actualText.replaceAll(new RegExp("^" + firstLineIndent, 'mg'), "").replace(/\n{2}$/, "\n");
|
|
194
|
+
}
|
|
@@ -22,7 +22,6 @@ const VariablesJSMonitorPlugin_1 = require("./plugins/VariablesJSMonitorPlugin")
|
|
|
22
22
|
const WPMLConfigBuilder_1 = require("./plugins/WPMLConfigBuilder");
|
|
23
23
|
const static_configs_1 = require("./plugins/static-configs");
|
|
24
24
|
const UnifiedLoaderGenerator_1 = require("./plugins/UnifiedLoaderGenerator");
|
|
25
|
-
const dependency_extraction_webpack_plugin_1 = __importDefault(require("@wordpress/dependency-extraction-webpack-plugin"));
|
|
26
25
|
const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
|
|
27
26
|
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
28
27
|
const webpack_remove_empty_scripts_1 = __importDefault(require("webpack-remove-empty-scripts"));
|
|
@@ -400,10 +399,16 @@ function buildCommonPluginConfig(webpackConfig, config, bundleAnalyzer, assumeGl
|
|
|
400
399
|
plugins.push(new SpecialAssetHandlingPlugin_1.SpecialAssetHandlingPlugin(config));
|
|
401
400
|
}
|
|
402
401
|
plugins.push(new VariablesJSMonitorPlugin_1.VariablesJSMonitorPlugin(config));
|
|
403
|
-
|
|
402
|
+
// We have to use constructor.name here the version desyncs can result in multiple equivalent versions kicking around
|
|
403
|
+
const dependencyExtractionPluginIndex = plugins.findIndex(plugin => plugin.constructor.name === 'DependencyExtractionWebpackPlugin');
|
|
404
404
|
if (dependencyExtractionPluginIndex === -1) {
|
|
405
|
-
console.error(
|
|
406
|
-
|
|
405
|
+
console.error((0, shared_1.dedent) `
|
|
406
|
+
Unable to find the DependencyExtractionWebpackPlugin.
|
|
407
|
+
If this is your first time seeing this error, please run: pnpm up && pnpm dedupe && pnpm up
|
|
408
|
+
Once those commands have finished, re-run whichever command had this error. If it still doesn't work, report the issue immediately.
|
|
409
|
+
`);
|
|
410
|
+
console.error("Once those commands have finished, re-run whichever command had this error. If it still doesn't work, report the issue immediately.");
|
|
411
|
+
throw new Error("Cannot apply externals when they have been disabled via CLI flag. This will greatly increase bundle size and will likely cause the build to fail");
|
|
407
412
|
}
|
|
408
413
|
const builtDependencyExtractionWebpackPlugin = (0, dependency_extraction_webpack_plugin_config_builder_1.makeDependencyExtractionPlugin)(externals, assumeGlobalizedPlauditLibraries, true, externalize);
|
|
409
414
|
plugins[dependencyExtractionPluginIndex] = builtDependencyExtractionWebpackPlugin.instance;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "2.72.
|
|
3
|
+
"version": "2.72.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"files": [
|
|
6
6
|
"/build"
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@plaudit/gutenberg-api-extensions": "^2.
|
|
23
|
+
"@plaudit/gutenberg-api-extensions": "^2.78.1",
|
|
24
24
|
"@types/browser-sync-webpack-plugin": "^2.2.5",
|
|
25
|
-
"@types/node": "^24.
|
|
25
|
+
"@types/node": "^24.9.2",
|
|
26
26
|
"@types/postcss-functions": "^4.0.4",
|
|
27
27
|
"@types/tapable": "^2.3.0",
|
|
28
28
|
"@types/webpack": "^5.28.5",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"webpack-bundle-analyzer": "^4.10.2"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@plaudit/php-writer": "^1.
|
|
37
|
+
"@plaudit/php-writer": "^1.2.3",
|
|
38
38
|
"@plaudit/postcss-color-function": "^5.0.0",
|
|
39
39
|
"@plaudit/postcss-legacy-shorthand": "^1.0.0",
|
|
40
40
|
"@plaudit/postcss-silent-extend": "^3.0.0",
|
|
41
41
|
"@plaudit/postcss-strip-units": "^3.0.0",
|
|
42
42
|
"@plaudit/postcss-variables": "^1.1.0",
|
|
43
|
-
"@wordpress/dependency-extraction-webpack-plugin": "^6.
|
|
44
|
-
"@wordpress/scripts": "^30.
|
|
43
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^6.34.0",
|
|
44
|
+
"@wordpress/scripts": "^30.27.0",
|
|
45
45
|
"autoprefixer": "^10.4.21",
|
|
46
46
|
"browser-sync": "^3.0.4",
|
|
47
47
|
"copy-webpack-plugin": "^10.2.4",
|