@plaudit/webpack-extensions 2.49.0 → 2.51.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/build/wordpress-scripts-wrapper/AdditionalDependencyInjectorPlugin.d.ts +1 -1
- package/build/wordpress-scripts-wrapper/AdditionalDependencyInjectorPlugin.js +2 -1
- package/build/wordpress-scripts-wrapper/BlockJSONManagingPlugin.d.ts +1 -1
- package/build/wordpress-scripts-wrapper/BlockJSONManagingPlugin.js +2 -1
- package/build/wordpress-scripts-wrapper/ExtensionsConfigFileGeneratorPlugin.d.ts +1 -1
- package/build/wordpress-scripts-wrapper/ExtensionsConfigFileGeneratorPlugin.js +2 -1
- package/build/wordpress-scripts-wrapper/MiniCSSExtractPluginErrorCleaner.d.ts +1 -1
- package/build/wordpress-scripts-wrapper/MiniCSSExtractPluginErrorCleaner.js +2 -1
- package/build/wordpress-scripts-wrapper/PackageConfigSanityChecker.d.ts +4 -0
- package/build/wordpress-scripts-wrapper/PackageConfigSanityChecker.js +30 -0
- package/build/wordpress-scripts-wrapper/SpecialAssetHandlingPlugin.d.ts +1 -1
- package/build/wordpress-scripts-wrapper/SpecialAssetHandlingPlugin.js +2 -1
- package/build/wordpress-scripts-wrapper/VariablesJSMonitorPlugin.d.ts +1 -1
- package/build/wordpress-scripts-wrapper/VariablesJSMonitorPlugin.js +2 -1
- package/build/wordpress-scripts-wrapper/WPMLConfigBuilder.d.ts +2 -2
- package/build/wordpress-scripts-wrapper/WPMLConfigBuilder.js +10 -9
- package/build/wordpress-scripts-wrapper.d.ts +1 -0
- package/build/wordpress-scripts-wrapper.js +27 -22
- package/package.json +11 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Compiler, type WebpackPluginInstance } from "webpack";
|
|
2
|
-
export
|
|
2
|
+
export declare class AdditionalDependencyInjectorPlugin implements WebpackPluginInstance {
|
|
3
3
|
private readonly entrypointAdditionalDependencies;
|
|
4
4
|
private readonly processingModules;
|
|
5
5
|
private readonly addExternalizedDep;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AdditionalDependencyInjectorPlugin = void 0;
|
|
6
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
7
8
|
const webpack_1 = require("webpack");
|
|
8
9
|
class AdditionalDependencyInjectorPlugin {
|
|
@@ -54,4 +55,4 @@ class AdditionalDependencyInjectorPlugin {
|
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
exports.
|
|
58
|
+
exports.AdditionalDependencyInjectorPlugin = AdditionalDependencyInjectorPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Compilation, type Compiler, type WebpackPluginInstance } from "webpack";
|
|
2
|
-
export
|
|
2
|
+
export declare class BlockJSONManagingPlugin implements WebpackPluginInstance {
|
|
3
3
|
private readonly standaloneBlocks;
|
|
4
4
|
private readonly processingModules;
|
|
5
5
|
static readonly mappableModuleKeys: readonly ["viewScriptModule", "scriptModule"];
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BlockJSONManagingPlugin = void 0;
|
|
6
7
|
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
7
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -587,4 +588,4 @@ class BlockJSONManagingPlugin {
|
|
|
587
588
|
return [...files];
|
|
588
589
|
}
|
|
589
590
|
}
|
|
590
|
-
exports.
|
|
591
|
+
exports.BlockJSONManagingPlugin = BlockJSONManagingPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Compiler, type WebpackPluginInstance } from "webpack";
|
|
2
|
-
export
|
|
2
|
+
export declare class ExtensionsConfigFileGeneratorPlugin implements WebpackPluginInstance {
|
|
3
3
|
private readonly extensionsPath;
|
|
4
4
|
constructor(extensionsPath: string);
|
|
5
5
|
apply(compiler: Compiler): void;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ExtensionsConfigFileGeneratorPlugin = void 0;
|
|
6
7
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
7
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
9
|
const webpack_1 = require("webpack");
|
|
@@ -48,4 +49,4 @@ class ExtensionsConfigFileGeneratorPlugin {
|
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
|
-
exports.
|
|
52
|
+
exports.ExtensionsConfigFileGeneratorPlugin = ExtensionsConfigFileGeneratorPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Compiler, WebpackPluginInstance } from "webpack";
|
|
2
|
-
export
|
|
2
|
+
export declare class MiniCSSExtractPluginErrorCleaner implements WebpackPluginInstance {
|
|
3
3
|
apply(compiler: Compiler): void;
|
|
4
4
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MiniCSSExtractPluginErrorCleaner = void 0;
|
|
3
4
|
class MiniCSSExtractPluginErrorCleaner {
|
|
4
5
|
apply(compiler) {
|
|
5
6
|
compiler.hooks.done.tap("CleanupMiniCssExtractPlugin", stats => {
|
|
@@ -11,4 +12,4 @@ class MiniCSSExtractPluginErrorCleaner {
|
|
|
11
12
|
});
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
exports.
|
|
15
|
+
exports.MiniCSSExtractPluginErrorCleaner = MiniCSSExtractPluginErrorCleaner;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PackageConfigSanityChecker = void 0;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
class PackageConfigSanityChecker {
|
|
10
|
+
apply(compiler) {
|
|
11
|
+
compiler.hooks.thisCompilation.tap(this.constructor.name, compilation => {
|
|
12
|
+
const configs = [["postcss.config.js", true], ["babel-transform.js", false],
|
|
13
|
+
...["babel.config", ".babelrc"].flatMap(prefix => [`${prefix}.json`, `${prefix}.js`]).map((filename) => [filename, false])];
|
|
14
|
+
for (const [filename, blockable] of configs) {
|
|
15
|
+
const invalidFilePath = node_path_1.default.join(process.cwd(), filename);
|
|
16
|
+
if (node_fs_1.default.existsSync(invalidFilePath)) {
|
|
17
|
+
if (blockable) {
|
|
18
|
+
compilation.warnings.push(new Error(`The current project has a ${filename} file in its theme directory.`
|
|
19
|
+
+ ` It will be ignored, but SHOULD be deleted before continuing.\nTo fix it, run: rm ${invalidFilePath}`));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
compilation.errors.push(new Error(`The current project has a ${filename} file in its theme directory.`
|
|
23
|
+
+ ` It WILL cause issues and MUST be deleted before continuing.\nTo fix it, run: rm ${invalidFilePath}`));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.PackageConfigSanityChecker = PackageConfigSanityChecker;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Compiler, WebpackPluginInstance } from "webpack";
|
|
2
2
|
import { SharedCache } from "../shared";
|
|
3
|
-
export
|
|
3
|
+
export declare class SpecialAssetHandlingPlugin implements WebpackPluginInstance {
|
|
4
4
|
private readonly cache;
|
|
5
5
|
constructor(cache: SharedCache);
|
|
6
6
|
apply(compiler: Compiler): void;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SpecialAssetHandlingPlugin = void 0;
|
|
6
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
7
8
|
const webpack_1 = require("webpack");
|
|
8
9
|
class SpecialAssetHandlingPlugin {
|
|
@@ -103,4 +104,4 @@ class SpecialAssetHandlingPlugin {
|
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
exports.
|
|
107
|
+
exports.SpecialAssetHandlingPlugin = SpecialAssetHandlingPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Compiler, WebpackPluginInstance } from "webpack";
|
|
2
|
-
export
|
|
2
|
+
export declare class VariablesJSMonitorPlugin implements WebpackPluginInstance {
|
|
3
3
|
private readonly variablesFilePath;
|
|
4
4
|
constructor(variablesFilePath: string);
|
|
5
5
|
apply(compiler: Compiler): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VariablesJSMonitorPlugin = void 0;
|
|
3
4
|
class VariablesJSMonitorPlugin {
|
|
4
5
|
variablesFilePath;
|
|
5
6
|
constructor(variablesFilePath) {
|
|
@@ -13,4 +14,4 @@ class VariablesJSMonitorPlugin {
|
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
|
-
exports.
|
|
17
|
+
exports.VariablesJSMonitorPlugin = VariablesJSMonitorPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Compiler, type WebpackPluginInstance } from "webpack";
|
|
2
|
-
import BlockJSONManagingPlugin from "./BlockJSONManagingPlugin";
|
|
3
|
-
export
|
|
2
|
+
import { BlockJSONManagingPlugin } from "./BlockJSONManagingPlugin";
|
|
3
|
+
export declare class WPMLConfigBuilderPlugin implements WebpackPluginInstance {
|
|
4
4
|
private readonly blockJSONManagingPlugin;
|
|
5
5
|
private static jsdomInstance?;
|
|
6
6
|
private static domParser?;
|
|
@@ -3,11 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.WPMLConfigBuilderPlugin = void 0;
|
|
6
7
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
7
8
|
const jsdom_1 = require("jsdom");
|
|
8
9
|
const webpack_1 = require("webpack");
|
|
9
10
|
const xml_formatter_1 = __importDefault(require("xml-formatter"));
|
|
10
|
-
class
|
|
11
|
+
class WPMLConfigBuilderPlugin {
|
|
11
12
|
blockJSONManagingPlugin;
|
|
12
13
|
static jsdomInstance;
|
|
13
14
|
static domParser;
|
|
@@ -103,7 +104,7 @@ class WPMLConfigBuilder {
|
|
|
103
104
|
mergedConfig.gutenbergBlocks[blockConfig.type] = blockConfig;
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
const config =
|
|
107
|
+
const config = WPMLConfigBuilderPlugin.getDOMParser().parseFromString("<wpml-config></wpml-config>", "application/xml");
|
|
107
108
|
appendNamedElementsListToConfig("custom-fields", mergedConfig.customFields, config);
|
|
108
109
|
appendNamedElementsListToConfig("custom-term-fields", mergedConfig.customTermFields, config);
|
|
109
110
|
appendNamedElementsListToConfig("custom-types", mergedConfig.customTypes, config);
|
|
@@ -140,21 +141,21 @@ class WPMLConfigBuilder {
|
|
|
140
141
|
appendNamedElementsListToConfig("shortcodes", mergedConfig.shortcodes, config);
|
|
141
142
|
appendNamedElementsListToConfig("taxonomies", mergedConfig.taxonomies, config);
|
|
142
143
|
this.blockJSONManagingPlugin.additionalMetadata.set("wpml-config", true);
|
|
143
|
-
compilation["wpml-config.xml" in compilation.assets ? 'updateAsset' : 'emitAsset']("wpml-config.xml", new webpack_1.sources.RawSource(
|
|
144
|
+
compilation["wpml-config.xml" in compilation.assets ? 'updateAsset' : 'emitAsset']("wpml-config.xml", new webpack_1.sources.RawSource(WPMLConfigBuilderPlugin.prettyPrintXML(config)));
|
|
144
145
|
});
|
|
145
146
|
});
|
|
146
147
|
}
|
|
147
148
|
static getJSDOMInstance() {
|
|
148
|
-
return
|
|
149
|
+
return WPMLConfigBuilderPlugin.jsdomInstance ?? (WPMLConfigBuilderPlugin.jsdomInstance = new jsdom_1.JSDOM("", { contentType: "text/html" }));
|
|
149
150
|
}
|
|
150
151
|
static getDOMParser() {
|
|
151
|
-
return
|
|
152
|
+
return WPMLConfigBuilderPlugin.domParser ?? (WPMLConfigBuilderPlugin.domParser = new (WPMLConfigBuilderPlugin.getJSDOMInstance().window.DOMParser)());
|
|
152
153
|
}
|
|
153
154
|
static getXMLSerializer() {
|
|
154
|
-
return
|
|
155
|
+
return WPMLConfigBuilderPlugin.xmlSerializer ?? (WPMLConfigBuilderPlugin.xmlSerializer = new (WPMLConfigBuilderPlugin.getJSDOMInstance().window.XMLSerializer)());
|
|
155
156
|
}
|
|
156
157
|
static prettyPrintXML(document) {
|
|
157
|
-
return (0, xml_formatter_1.default)(
|
|
158
|
+
return (0, xml_formatter_1.default)(WPMLConfigBuilderPlugin.getXMLSerializer().serializeToString(document), {
|
|
158
159
|
indentation: '\t',
|
|
159
160
|
collapseContent: true,
|
|
160
161
|
lineSeparator: '\n',
|
|
@@ -172,7 +173,7 @@ class WPMLConfigBuilder {
|
|
|
172
173
|
if (existing?.raw === contents) {
|
|
173
174
|
return [existing, file];
|
|
174
175
|
}
|
|
175
|
-
const wpmlConfig =
|
|
176
|
+
const wpmlConfig = WPMLConfigBuilderPlugin.getDOMParser().parseFromString(contents.replaceAll(/\s+xmlns=['"][^'"]+['"]/sig, ""), "application/xml");
|
|
176
177
|
const res = { raw: contents, customFields: {}, customTermFields: {}, customTypes: {}, gutenbergBlocks: {}, shortcodeList: new Set(), shortcodes: {}, taxonomies: {} };
|
|
177
178
|
for (const element of wpmlConfig.documentElement.children) {
|
|
178
179
|
switch (element.nodeName) {
|
|
@@ -243,7 +244,7 @@ class WPMLConfigBuilder {
|
|
|
243
244
|
return [res, file];
|
|
244
245
|
}
|
|
245
246
|
}
|
|
246
|
-
exports.
|
|
247
|
+
exports.WPMLConfigBuilderPlugin = WPMLConfigBuilderPlugin;
|
|
247
248
|
function importStandardTranslateOptionMap(element, file, type, actionMap, compilation) {
|
|
248
249
|
for (const child of element.children) {
|
|
249
250
|
const field = child.textContent;
|
|
@@ -8,6 +8,7 @@ interface AdvancedOutputConfig {
|
|
|
8
8
|
directoryLayout?: 'blocks' | 'extensions' | 'plain';
|
|
9
9
|
assumeGlobalizedPlauditLibraries?: boolean;
|
|
10
10
|
externalize?: Required<Configuration>['output']['library'];
|
|
11
|
+
bundleAnalyzer?: boolean;
|
|
11
12
|
}
|
|
12
13
|
type PlauditWordpressWebpackConfig = {
|
|
13
14
|
standaloneBlocks?: boolean;
|
|
@@ -5,16 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
6
6
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const AdditionalDependencyInjectorPlugin_1 =
|
|
9
|
-
const BlockJSONManagingPlugin_1 =
|
|
10
|
-
const dependency_extraction_webpack_plugin_config_builder_1 = require("./wordpress-scripts-wrapper/dependency-extraction-webpack-plugin-config-builder");
|
|
11
|
-
const ExtensionsConfigFileGeneratorPlugin_1 = __importDefault(require("./wordpress-scripts-wrapper/ExtensionsConfigFileGeneratorPlugin"));
|
|
12
|
-
const SpecialAssetHandlingPlugin_1 = __importDefault(require("./wordpress-scripts-wrapper/SpecialAssetHandlingPlugin"));
|
|
13
|
-
const MiniCSSExtractPluginErrorCleaner_1 = __importDefault(require("./wordpress-scripts-wrapper/MiniCSSExtractPluginErrorCleaner"));
|
|
14
|
-
const VariablesJSMonitorPlugin_1 = __importDefault(require("./wordpress-scripts-wrapper/VariablesJSMonitorPlugin"));
|
|
8
|
+
const AdditionalDependencyInjectorPlugin_1 = require("./wordpress-scripts-wrapper/AdditionalDependencyInjectorPlugin");
|
|
9
|
+
const BlockJSONManagingPlugin_1 = require("./wordpress-scripts-wrapper/BlockJSONManagingPlugin");
|
|
15
10
|
const BrowserSyncPlugin_1 = require("./wordpress-scripts-wrapper/BrowserSyncPlugin");
|
|
11
|
+
const ExtensionsConfigFileGeneratorPlugin_1 = require("./wordpress-scripts-wrapper/ExtensionsConfigFileGeneratorPlugin");
|
|
12
|
+
const MiniCSSExtractPluginErrorCleaner_1 = require("./wordpress-scripts-wrapper/MiniCSSExtractPluginErrorCleaner");
|
|
13
|
+
const PackageConfigSanityChecker_1 = require("./wordpress-scripts-wrapper/PackageConfigSanityChecker");
|
|
14
|
+
const SpecialAssetHandlingPlugin_1 = require("./wordpress-scripts-wrapper/SpecialAssetHandlingPlugin");
|
|
15
|
+
const VariablesJSMonitorPlugin_1 = require("./wordpress-scripts-wrapper/VariablesJSMonitorPlugin");
|
|
16
|
+
const WPMLConfigBuilder_1 = require("./wordpress-scripts-wrapper/WPMLConfigBuilder");
|
|
16
17
|
const static_configs_1 = require("./wordpress-scripts-wrapper/static-configs");
|
|
17
|
-
const
|
|
18
|
+
const dependency_extraction_webpack_plugin_config_builder_1 = require("./wordpress-scripts-wrapper/dependency-extraction-webpack-plugin-config-builder");
|
|
18
19
|
const dependency_extraction_webpack_plugin_1 = __importDefault(require("@wordpress/dependency-extraction-webpack-plugin"));
|
|
19
20
|
const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
|
|
20
21
|
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
@@ -22,13 +23,13 @@ const webpack_remove_empty_scripts_1 = __importDefault(require("webpack-remove-e
|
|
|
22
23
|
function joinPossiblyAbsolutePaths(...paths) {
|
|
23
24
|
return paths.reduce((res, p) => !res || node_path_1.default.isAbsolute(p) ? p : node_path_1.default.join(res, p), '') || '.';
|
|
24
25
|
}
|
|
25
|
-
function mapToRealEntrypoints(entrypoint, dir, mapper = (entrypoint) => entrypoint, lazyDependent) {
|
|
26
|
+
function mapToRealEntrypoints(entrypoint, dir, mapper = (entrypoint) => entrypoint, lazyDependent, associatedQuery) {
|
|
26
27
|
return (Array.isArray(entrypoint) ? entrypoint : [entrypoint])
|
|
27
28
|
.map(ep => joinPossiblyAbsolutePaths(dir, mapper(ep)))
|
|
28
29
|
.filter(ep => node_fs_1.default.statSync(ep, { throwIfNoEntry: false })?.isFile())
|
|
29
30
|
.map(ep => {
|
|
30
31
|
const parsedEntrypoint = node_path_1.default.parse(ep);
|
|
31
|
-
return [joinPossiblyAbsolutePaths(node_path_1.default.basename(parsedEntrypoint.dir), parsedEntrypoint.name), { import: ep, lazyDependent }];
|
|
32
|
+
return [joinPossiblyAbsolutePaths(node_path_1.default.basename(parsedEntrypoint.dir), parsedEntrypoint.name), { import: ep, lazyDependent, associatedQuery }];
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
let isInThemeCache = undefined;
|
|
@@ -176,10 +177,10 @@ function injectPostcssConfigOverrides(rules, variables, postcssFunctionsConfig,
|
|
|
176
177
|
}
|
|
177
178
|
if (useItem.loader?.includes('postcss-loader')) {
|
|
178
179
|
if (useItem.options["postcssOptions"]) {
|
|
179
|
-
useItem.options["postcssOptions"] = { ...useItem.options["postcssOptions"], ...postcssConfig, sourceMap: true };
|
|
180
|
+
useItem.options["postcssOptions"] = { ...useItem.options["postcssOptions"], ...postcssConfig, sourceMap: true, config: false };
|
|
180
181
|
}
|
|
181
182
|
else {
|
|
182
|
-
useItem.options["postcssOptions"] = { ...postcssConfig, sourceMap: true };
|
|
183
|
+
useItem.options["postcssOptions"] = { ...postcssConfig, sourceMap: true, config: false };
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
186
|
}
|
|
@@ -296,6 +297,10 @@ function processIndividualWebpackConfig(config, webpackConfig, sources, sharedCa
|
|
|
296
297
|
return plugin;
|
|
297
298
|
})
|
|
298
299
|
?? [];
|
|
300
|
+
plugins.splice(0, 0, new PackageConfigSanityChecker_1.PackageConfigSanityChecker());
|
|
301
|
+
if (typeof dest !== 'string' && dest.bundleAnalyzer) {
|
|
302
|
+
plugins.splice(0, 0, new (require("webpack-bundle-analyzer").BundleAnalyzerPlugin)({ analyzerMode: 'static' }));
|
|
303
|
+
}
|
|
299
304
|
if (process.env["NO_TS_CHECKER"] !== "true") {
|
|
300
305
|
const include = (Array.isArray(srcRoot) ? srcRoot : [srcRoot])
|
|
301
306
|
.filter(sr => node_path_1.default.extname(sr).length === 0 || scriptOrStyleTest(sr, scriptExtension) === "script")
|
|
@@ -326,33 +331,33 @@ function processIndividualWebpackConfig(config, webpackConfig, sources, sharedCa
|
|
|
326
331
|
plugins.push(new webpack_remove_empty_scripts_1.default({
|
|
327
332
|
stage: webpack_remove_empty_scripts_1.default.STAGE_AFTER_PROCESS_PLUGINS,
|
|
328
333
|
extensions: ['css', 'scss', 'sass', 'less', 'styl', 'pcss']
|
|
329
|
-
}), new MiniCSSExtractPluginErrorCleaner_1.
|
|
334
|
+
}), new MiniCSSExtractPluginErrorCleaner_1.MiniCSSExtractPluginErrorCleaner());
|
|
330
335
|
if (config.useWebpackResourceFiltering) {
|
|
331
|
-
plugins.push(new SpecialAssetHandlingPlugin_1.
|
|
336
|
+
plugins.push(new SpecialAssetHandlingPlugin_1.SpecialAssetHandlingPlugin(sharedCache));
|
|
332
337
|
}
|
|
333
338
|
if (variablesFilePath) {
|
|
334
|
-
plugins.push(new VariablesJSMonitorPlugin_1.
|
|
339
|
+
plugins.push(new VariablesJSMonitorPlugin_1.VariablesJSMonitorPlugin(variablesFilePath));
|
|
335
340
|
}
|
|
336
341
|
const forBlocksDirectory = copyFiles && (typeof dest === 'string' || (dest.directoryLayout !== 'extensions' && dest.directoryLayout !== 'plain'));
|
|
337
342
|
if (forBlocksDirectory) {
|
|
338
|
-
const blockJSONManagingPlugin = new BlockJSONManagingPlugin_1.
|
|
343
|
+
const blockJSONManagingPlugin = new BlockJSONManagingPlugin_1.BlockJSONManagingPlugin(standaloneBlocks, processingModules);
|
|
339
344
|
plugins.push(blockJSONManagingPlugin);
|
|
340
345
|
if (config.processTranslationConfigs && srcIsDirectory && !processingModules) {
|
|
341
|
-
plugins.push(new WPMLConfigBuilder_1.
|
|
346
|
+
plugins.push(new WPMLConfigBuilder_1.WPMLConfigBuilderPlugin(blockJSONManagingPlugin));
|
|
342
347
|
}
|
|
343
348
|
}
|
|
344
349
|
const pluginIndex = plugins.findIndex(plugin => plugin instanceof dependency_extraction_webpack_plugin_1.default);
|
|
345
350
|
if (pluginIndex === -1) {
|
|
346
|
-
console.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
|
|
351
|
+
console.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");
|
|
347
352
|
}
|
|
348
353
|
else {
|
|
349
354
|
const localAssumeGlobalizedPlauditLibraries = (typeof dest !== 'string' ? dest.assumeGlobalizedPlauditLibraries : undefined) ?? assumeGlobalizedPlauditLibraries;
|
|
350
355
|
const builtDependencyExtractionWebpackPlugin = (0, dependency_extraction_webpack_plugin_config_builder_1.makeDependencyExtractionPlugin)(externals, localAssumeGlobalizedPlauditLibraries, combineAssetMetadata && !processingModules && forBlocksDirectory, typeof dest !== 'string' ? dest.externalize : undefined);
|
|
351
356
|
plugins[pluginIndex] = builtDependencyExtractionWebpackPlugin.instance;
|
|
352
|
-
plugins.push(new AdditionalDependencyInjectorPlugin_1.
|
|
357
|
+
plugins.push(new AdditionalDependencyInjectorPlugin_1.AdditionalDependencyInjectorPlugin(typeof dest !== 'string' && dest.additionalDependencies ? dest.additionalDependencies : [], processingModules, builtDependencyExtractionWebpackPlugin.addExternalizedDep));
|
|
353
358
|
}
|
|
354
359
|
if (srcIsDirectory && (typeof dest !== 'string' && dest.directoryLayout === 'extensions')) {
|
|
355
|
-
plugins.push(new ExtensionsConfigFileGeneratorPlugin_1.
|
|
360
|
+
plugins.push(new ExtensionsConfigFileGeneratorPlugin_1.ExtensionsConfigFileGeneratorPlugin(srcRoot));
|
|
356
361
|
}
|
|
357
362
|
if (process.argv.includes('--browser-sync') || process.env['BROWSER_SYNC'] === 'true') {
|
|
358
363
|
plugins.push(new BrowserSyncPlugin_1.BrowserSyncPlugin());
|
|
@@ -393,7 +398,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources, sharedCa
|
|
|
393
398
|
}
|
|
394
399
|
}
|
|
395
400
|
wpmlFiles.push(node_path_1.default.join(dir, 'block.json'));
|
|
396
|
-
BlockJSONManagingPlugin_1.
|
|
401
|
+
BlockJSONManagingPlugin_1.BlockJSONManagingPlugin.recordBlockJSONAssetSourceDir(blockJSONChunkName, dir);
|
|
397
402
|
}
|
|
398
403
|
catch (e) {
|
|
399
404
|
try {
|
|
@@ -440,7 +445,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources, sharedCa
|
|
|
440
445
|
// This is used to allow for block.json dependencies to correctly account for name-deduplication
|
|
441
446
|
for (const [key, entry] of Object.entries(currentEntry)) {
|
|
442
447
|
if (typeof entry === 'object' && !Array.isArray(entry) && 'lazyDependent' in entry && typeof entry.lazyDependent === 'string') {
|
|
443
|
-
BlockJSONManagingPlugin_1.
|
|
448
|
+
BlockJSONManagingPlugin_1.BlockJSONManagingPlugin.recordRawDependency(entry.lazyDependent, key);
|
|
444
449
|
}
|
|
445
450
|
}
|
|
446
451
|
if (!processingModules) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.51.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"files": [
|
|
6
6
|
"/build"
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@plaudit/gutenberg-api-extensions": "^2.
|
|
19
|
+
"@plaudit/gutenberg-api-extensions": "^2.72.0",
|
|
20
20
|
"@types/browser-sync-webpack-plugin": "^2.2.5",
|
|
21
|
-
"@types/node": "^22.15.
|
|
21
|
+
"@types/node": "^22.15.29",
|
|
22
22
|
"@types/postcss-functions": "^4.0.4",
|
|
23
23
|
"@types/tapable": "^2.2.7",
|
|
24
24
|
"@types/webpack": "^5.28.5",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"postcss-load-config": "^4.0.2",
|
|
27
27
|
"postcss-loader": "^7.3.4",
|
|
28
28
|
"ts-node": "^10.9.2",
|
|
29
|
-
"typescript": "^5.8.3"
|
|
29
|
+
"typescript": "^5.8.3",
|
|
30
|
+
"webpack-bundle-analyzer": "^4.10.2"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"@plaudit/postcss-color-function": "^5.0.0",
|
|
@@ -34,8 +35,8 @@
|
|
|
34
35
|
"@plaudit/postcss-silent-extend": "^3.0.0",
|
|
35
36
|
"@plaudit/postcss-strip-units": "^3.0.0",
|
|
36
37
|
"@plaudit/postcss-variables": "^1.1.0",
|
|
37
|
-
"@wordpress/dependency-extraction-webpack-plugin": "^6.
|
|
38
|
-
"@wordpress/scripts": "^30.
|
|
38
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^6.24.0",
|
|
39
|
+
"@wordpress/scripts": "^30.17.0",
|
|
39
40
|
"autoprefixer": "^10.4.21",
|
|
40
41
|
"browser-sync": "^3.0.4",
|
|
41
42
|
"clean-webpack-plugin": "^4.0.0",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
|
46
47
|
"http-proxy-middleware": "^3.0.5",
|
|
47
48
|
"json2php": "^0.0.12",
|
|
48
|
-
"postcss": "^8.5.
|
|
49
|
+
"postcss": "^8.5.4",
|
|
49
50
|
"postcss-calc": "^9.0.1",
|
|
50
51
|
"postcss-discard-comments": "^6.0.2",
|
|
51
52
|
"postcss-fallback": "^0.1.0",
|
|
@@ -62,8 +63,8 @@
|
|
|
62
63
|
"postcss-url": "^10.1.3",
|
|
63
64
|
"react": "^18.3.1",
|
|
64
65
|
"react-dom": "^18.3.1",
|
|
65
|
-
"webpack": "^5.99.
|
|
66
|
-
"webpack-remove-empty-scripts": "^1.
|
|
66
|
+
"webpack": "^5.99.9",
|
|
67
|
+
"webpack-remove-empty-scripts": "^1.1.1",
|
|
67
68
|
"xml-formatter": "^3.6.6"
|
|
68
69
|
},
|
|
69
70
|
"engines": {
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
},
|
|
72
73
|
"scripts": {
|
|
73
74
|
"build": "tsc",
|
|
74
|
-
"clean": "rm -rf build
|
|
75
|
+
"clean": "rm -rf build",
|
|
75
76
|
"build:clean": "pnpm run clean && pnpm run build",
|
|
76
77
|
"watch": "tsc -w"
|
|
77
78
|
}
|