@plaudit/webpack-extensions 2.69.0 → 2.70.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/plugins/AbstractBiPhasicGroupAndEntryPlugin.d.ts +2 -2
- package/build/plugins/AbstractBiPhasicGroupPlugin.d.ts +3 -2
- package/build/plugins/AbstractBiPhasicGroupPlugin.js +1 -1
- package/build/plugins/AdditionalDependencyInjectorPlugin.d.ts +1 -1
- package/build/plugins/EnhancedDynamicEntryPlugin.d.ts +1 -1
- package/build/plugins/ExtensionsConfigFileGeneratorPlugin.d.ts +2 -1
- package/build/plugins/ExtensionsConfigFileGeneratorPluginV1.d.ts +2 -1
- package/build/plugins/PlainEntrypointsConfigFileGeneratorPlugin.d.ts +2 -1
- package/build/plugins/PlainEntrypointsConfigFileGeneratorPlugin.js +1 -1
- package/build/plugins/PlainEntrypointsStyleBlockJSONPlugin.d.ts +2 -1
- package/build/plugins/PlainEntrypointsStyleBlockJSONPlugin.js +1 -1
- package/build/plugins/SpecialAssetHandlingPlugin.d.ts +1 -1
- package/build/plugins/UnifiedLoaderGenerator.d.ts +1 -1
- package/build/plugins/VariablesJSMonitorPlugin.d.ts +1 -1
- package/build/shared.d.ts +4 -17
- package/build/utils/common-config-helpers.d.ts +5 -1
- package/build/wordpress-scripts-wrapper.js +4 -8
- package/package.json +10 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ParsedAssetsJson, VerifiedAdvancedOutputConfig
|
|
2
|
-
import type { ExtensibleEntryObject } from "../utils/common-config-helpers";
|
|
1
|
+
import { ParsedAssetsJson, VerifiedAdvancedOutputConfig } from "../shared";
|
|
2
|
+
import type { ExtensibleEntryObject, VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
3
3
|
import { PseudoSemaphore } from "../utils/pseduo-semaphore";
|
|
4
4
|
import { AbstractBiPhasicGroupPlugin } from "./AbstractBiPhasicGroupPlugin";
|
|
5
5
|
import { Compilation, Compiler, Entrypoint } from "webpack";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { PseudoSemaphore } from "../utils/pseduo-semaphore";
|
|
2
|
-
import { type ParsedAssetsJson, type VerifiedPlauditWordpressWebpackConfig } from "../shared";
|
|
3
1
|
import { Compilation, Compiler, type WebpackPluginInstance } from "webpack";
|
|
2
|
+
import { PseudoSemaphore } from "../utils/pseduo-semaphore";
|
|
3
|
+
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
4
|
+
import { ParsedAssetsJson } from "../shared";
|
|
4
5
|
type TapWithAssetsJsonOptions = {
|
|
5
6
|
name?: string;
|
|
6
7
|
stage?: (typeof Compilation.PROCESS_ASSETS_STAGE_REPORT) | (typeof Compilation.PROCESS_ASSETS_STAGE_ANALYSE);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AbstractBiPhasicGroupPlugin = void 0;
|
|
4
|
-
const shared_1 = require("../shared");
|
|
5
4
|
const webpack_1 = require("webpack");
|
|
5
|
+
const shared_1 = require("../shared");
|
|
6
6
|
class AbstractBiPhasicGroupPlugin {
|
|
7
7
|
config;
|
|
8
8
|
group;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractBiPhasicGroupPlugin } from "./AbstractBiPhasicGroupPlugin";
|
|
2
2
|
import type { AbstractBiPhasicGroupAndEntryPlugin } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
3
|
-
import { VerifiedPlauditWordpressWebpackConfig } from "../
|
|
3
|
+
import { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
4
4
|
import { Compilation } from "webpack";
|
|
5
5
|
export declare class AdditionalDependencyInjectorPlugin extends AbstractBiPhasicGroupPlugin {
|
|
6
6
|
private readonly processingModules;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
|
-
import type { VerifiedPlauditWordpressWebpackConfig } from "../
|
|
2
|
+
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
3
3
|
export declare class EnhancedDynamicEntryPlugin extends AbstractBiPhasicGroupAndEntryPlugin {
|
|
4
4
|
constructor(config: VerifiedPlauditWordpressWebpackConfig, context: string, entry: EntryProvider);
|
|
5
5
|
protected attachUniquePhase(): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
|
-
import { ParsedAssetsJson, VerifiedAdvancedOutputConfig
|
|
2
|
+
import { ParsedAssetsJson, VerifiedAdvancedOutputConfig } from "../shared";
|
|
3
|
+
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
3
4
|
import { Compilation, type Compiler } from "webpack";
|
|
4
5
|
export declare class ExtensionsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryPlugin {
|
|
5
6
|
private readonly extensionsSrcPath;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
|
-
import type { ParsedAssetsJson
|
|
2
|
+
import type { ParsedAssetsJson } from "../shared";
|
|
3
|
+
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
3
4
|
import { Compilation } from "webpack";
|
|
4
5
|
export declare class ExtensionsConfigFileGeneratorPluginV1 extends AbstractBiPhasicGroupAndEntryPlugin {
|
|
5
6
|
private readonly extensionsDest;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ParsedAssetsJson, BlockEntrypointInfo, UsageLocations
|
|
1
|
+
import { ParsedAssetsJson, BlockEntrypointInfo, UsageLocations } from "../shared";
|
|
2
|
+
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
2
3
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
3
4
|
import { Compilation } from "webpack";
|
|
4
5
|
export declare class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryPlugin<BlockEntrypointInfo> {
|
|
@@ -85,7 +85,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
85
85
|
for (const { handle, type, data } of prioritizedHandleList) {
|
|
86
86
|
writer.call(`wp_register_${type}`, [handle, php_writer_1.Op.concat(baseUriVar, node_path_1.default.relative(emitDir, data.src)), ...data.rest]);
|
|
87
87
|
}
|
|
88
|
-
}, { priority, accountForAlreadyDoing: this.config.
|
|
88
|
+
}, { priority, accountForAlreadyDoing: this.config.includePostInitFallback });
|
|
89
89
|
}
|
|
90
90
|
const sortedEditorStyleHandles = sortedStyleHandles
|
|
91
91
|
.filter(([_, { locations: { clientEditor }, type }]) => type === 'style' && (clientEditor || typeof clientEditor === 'number'))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
|
-
import { ParsedAssetsJson, BlockEntrypointInfo, FileSegmentBlockEntrypointInfo
|
|
2
|
+
import { ParsedAssetsJson, BlockEntrypointInfo, FileSegmentBlockEntrypointInfo } from "../shared";
|
|
3
|
+
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
3
4
|
import { Compilation } from "webpack";
|
|
4
5
|
import type WebpackRemoveEmptyScriptsPlugin from "webpack-remove-empty-scripts";
|
|
5
6
|
type WorkableBlockEntrypointInfo = Omit<FileSegmentBlockEntrypointInfo, 'originalValue'> & Partial<Pick<FileSegmentBlockEntrypointInfo, 'originalValue'>> & {
|
|
@@ -105,7 +105,7 @@ class PlainEntrypointsStyleBlockJSONPlugin extends AbstractBiPhasicGroupAndEntry
|
|
|
105
105
|
.action("init", writer => {
|
|
106
106
|
writer.call("\\Plaudit\\Common\\ACF\\BlockManager::autoloadSubfoldersV3", [php_writer_1.Constants.__DIR__, new php_writer_1.EnclosedLiteral((0, shared_1.makeEmittableConfigPHP)(blockData, false, "\t")),
|
|
107
107
|
php_writer_1.Constants.__FILE__, new php_writer_1.EnclosedLiteral((0, shared_1.makeEmittableConfigPHP)(metadata, false, "\t")), null]);
|
|
108
|
-
}, { accountForAlreadyDoing:
|
|
108
|
+
}, { accountForAlreadyDoing: this.config.includePostInitFallback })
|
|
109
109
|
.emitAsset(compilation, node_path_1.default.join(this.blocksDest, "blockdir-loader.php"));
|
|
110
110
|
}
|
|
111
111
|
else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VerifiedPlauditWordpressWebpackConfig } from "../
|
|
1
|
+
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
2
2
|
import { AbstractBiPhasicGroupPlugin } from "./AbstractBiPhasicGroupPlugin";
|
|
3
3
|
import { Compilation } from "webpack";
|
|
4
4
|
export declare class SpecialAssetHandlingPlugin extends AbstractBiPhasicGroupPlugin {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractBiPhasicGroupPlugin } from "./AbstractBiPhasicGroupPlugin";
|
|
2
|
-
import { VerifiedPlauditWordpressWebpackConfig } from "../
|
|
2
|
+
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
3
3
|
import { PHPWriter } from "../utils/php-writer";
|
|
4
4
|
import { PseudoSemaphore } from "../utils/pseduo-semaphore";
|
|
5
5
|
import { Compilation } from "webpack";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VerifiedPlauditWordpressWebpackConfig } from "../
|
|
1
|
+
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
2
2
|
import type { Compiler, WebpackPluginInstance } from "webpack";
|
|
3
3
|
export declare class VariablesJSMonitorPlugin implements WebpackPluginInstance {
|
|
4
4
|
private readonly config;
|
package/build/shared.d.ts
CHANGED
|
@@ -82,15 +82,12 @@ type OptionalCfgFields = 'directoryLayout' | 'externalize' | 'lazyLoader';
|
|
|
82
82
|
export type VerifiedAdvancedOutputConfig = Required<Omit<AdvancedOutputConfig, 'locations' | OptionalCfgFields>> & Pick<AdvancedOutputConfig, OptionalCfgFields> & {
|
|
83
83
|
locations: UsageLocations;
|
|
84
84
|
};
|
|
85
|
-
type
|
|
86
|
-
|
|
87
|
-
plainEntrypointsVersion?: PlainEntrypointsSettings['version'];
|
|
88
|
-
};
|
|
89
|
-
type PlauditWordpressWebpackConfigProps = {
|
|
85
|
+
export type SourcesObject = Record<string, string | AdvancedOutputConfig | boolean>;
|
|
86
|
+
export type PlauditWordpressWebpackConfig = {
|
|
90
87
|
standaloneBlocks?: boolean;
|
|
91
88
|
variables?: Record<string, any>;
|
|
92
89
|
verbose?: boolean;
|
|
93
|
-
src: string[] |
|
|
90
|
+
src: string[] | SourcesObject;
|
|
94
91
|
stats?: Configuration['stats'];
|
|
95
92
|
postcss?: {
|
|
96
93
|
functions?: (variables: (name: string) => unknown) => PostcssFunctionsOptions['functions'];
|
|
@@ -103,21 +100,11 @@ type PlauditWordpressWebpackConfigProps = {
|
|
|
103
100
|
outputDir?: string;
|
|
104
101
|
extensionsVersion?: 1 | 2 | 3;
|
|
105
102
|
targetHandlePrefix?: string;
|
|
106
|
-
|
|
103
|
+
plainEntrypointsVersion?: 1 | 2;
|
|
107
104
|
srcDir?: string;
|
|
108
105
|
srcPrefixes?: string[];
|
|
109
106
|
useUnifiedLoader?: boolean;
|
|
110
|
-
};
|
|
111
|
-
type PlainEntrypointsSettings = {
|
|
112
107
|
includePostInitFallback?: boolean;
|
|
113
|
-
version: 1 | 2;
|
|
114
|
-
};
|
|
115
|
-
export type PlauditWordpressWebpackConfig = PlauditWordpressWebpackConfigProps & DeprecatedPlauditWordpressWebpackConfigProps;
|
|
116
|
-
export type VerifiedPlauditWordpressWebpackConfig = Required<Omit<PlauditWordpressWebpackConfigProps, 'variables' | 'src' | 'externals' | 'plainEntrypointsSettings'>> & {
|
|
117
|
-
variablesFilePath?: string;
|
|
118
|
-
currentVariables: Record<string, any>;
|
|
119
|
-
} & Pick<PlauditWordpressWebpackConfig, 'externals'> & {
|
|
120
|
-
plainEntrypointsSettings: Required<PlainEntrypointsSettings>;
|
|
121
108
|
};
|
|
122
109
|
export type FileSegmentBlockEntrypointInfo = {
|
|
123
110
|
blockJsonOrigin: string;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "../plugins/AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
2
|
import type { AdditionalDependencyInjectorPlugin } from "../plugins/AdditionalDependencyInjectorPlugin";
|
|
3
|
-
import { EntrypointFields,
|
|
3
|
+
import { EntrypointFields, PlauditWordpressWebpackConfig, BlockEntrypointInfo, VerifiedAdvancedOutputConfig } from "../shared";
|
|
4
4
|
import type { Compiler, Configuration, DynamicEntryPlugin, WebpackPluginInstance } from "webpack";
|
|
5
5
|
import type WebpackRemoveEmptyScriptsPlugin from "webpack-remove-empty-scripts";
|
|
6
|
+
export type VerifiedPlauditWordpressWebpackConfig = Required<Omit<PlauditWordpressWebpackConfig, 'variables' | 'src' | 'externals'>> & {
|
|
7
|
+
variablesFilePath?: string;
|
|
8
|
+
currentVariables: Record<string, any>;
|
|
9
|
+
} & Pick<PlauditWordpressWebpackConfig, 'externals'>;
|
|
6
10
|
export type CommonPluginConfig = {
|
|
7
11
|
plugins: (WebpackPluginInstance | ((this: Compiler, compiler: Compiler) => void))[];
|
|
8
12
|
removeEmptyScriptsPlugin: WebpackRemoveEmptyScriptsPlugin;
|
|
@@ -172,11 +172,7 @@ function injectSupportForInliningSVGsAsStrings(rules) {
|
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
function buildVerifiedConfig(config) {
|
|
175
|
-
const { standaloneBlocks = false, stats = 'errors-warnings', variables: rawVariables, verbose = process.argv.includes('--verbose') || process.env['VERBOSE'] === 'true', postcss = {}, externals, assumeGlobalizedPlauditLibraries = true, processTranslationConfigs = true, combineAssetMetadata = true, useWebpackResourceFiltering = true, outputDir = "", srcDir = "", useUnifiedLoader = false } = config;
|
|
176
|
-
const plainEntrypointsSettings = {
|
|
177
|
-
version: config.plainEntrypointsSettings?.version ?? config.plainEntrypointsVersion ?? 1,
|
|
178
|
-
includePostInitFallback: config.plainEntrypointsSettings?.includePostInitFallback ?? true
|
|
179
|
-
};
|
|
175
|
+
const { standaloneBlocks = false, stats = 'errors-warnings', variables: rawVariables, verbose = process.argv.includes('--verbose') || process.env['VERBOSE'] === 'true', postcss = {}, externals, assumeGlobalizedPlauditLibraries = true, processTranslationConfigs = true, combineAssetMetadata = true, useWebpackResourceFiltering = true, outputDir = "", plainEntrypointsVersion = 1, srcDir = "", useUnifiedLoader = false, includePostInitFallback = true } = config;
|
|
180
176
|
let srcPrefixes;
|
|
181
177
|
const trailingSlashedSrcDir = srcDir && !srcDir.endsWith("/") ? srcDir + "/" : srcDir;
|
|
182
178
|
if (config.srcPrefixes === undefined) {
|
|
@@ -186,7 +182,7 @@ function buildVerifiedConfig(config) {
|
|
|
186
182
|
srcPrefixes = (srcDir && !config.srcPrefixes.includes(trailingSlashedSrcDir) ? [...config.srcPrefixes, trailingSlashedSrcDir] : config.srcPrefixes);
|
|
187
183
|
}
|
|
188
184
|
let targetHandlePrefix = config.targetHandlePrefix ?? config.plainEntrypointsHandlePrefix ?? "";
|
|
189
|
-
if (
|
|
185
|
+
if (plainEntrypointsVersion > 1) {
|
|
190
186
|
if (!targetHandlePrefix) {
|
|
191
187
|
targetHandlePrefix = deriveDefaultHandlePrefixFromComposerJsonOrThemeName();
|
|
192
188
|
if (!targetHandlePrefix) {
|
|
@@ -224,7 +220,7 @@ function buildVerifiedConfig(config) {
|
|
|
224
220
|
}
|
|
225
221
|
const cfg = {
|
|
226
222
|
currentVariables, postcss, standaloneBlocks, stats, variablesFilePath, verbose, externals, assumeGlobalizedPlauditLibraries, processTranslationConfigs, combineAssetMetadata,
|
|
227
|
-
useWebpackResourceFiltering, outputDir, extensionsVersion,
|
|
223
|
+
useWebpackResourceFiltering, outputDir, extensionsVersion, plainEntrypointsVersion, srcDir, srcPrefixes, targetHandlePrefix, useUnifiedLoader, includePostInitFallback
|
|
228
224
|
};
|
|
229
225
|
// Destination -> source map
|
|
230
226
|
const allocatedDestinations = {};
|
|
@@ -526,7 +522,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources, canClean
|
|
|
526
522
|
}
|
|
527
523
|
}
|
|
528
524
|
const baseDest = stripExtension(dest.destination);
|
|
529
|
-
if (config.
|
|
525
|
+
if (config.plainEntrypointsVersion > 1) {
|
|
530
526
|
const entry = srcIsDirectory // This being true implies that srcRoot is not an array
|
|
531
527
|
? (0, common_config_helpers_1.resolveEntryFromDirectory)(commonConfig, srcRoot, dest)
|
|
532
528
|
: () => ({ [baseDest]: { import: Array.isArray(srcRoot) ? srcRoot : [srcRoot], plauditMetadata: { purpose: "plain-entrypoint", dest } } });
|
package/package.json
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.70.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"files": [
|
|
6
6
|
"/build"
|
|
7
7
|
],
|
|
8
8
|
"exports": {
|
|
9
|
-
"./wordpress-scripts-wrapper": "./build/wordpress-scripts-wrapper.js"
|
|
9
|
+
"./wordpress-scripts-wrapper": "./build/wordpress-scripts-wrapper.js",
|
|
10
|
+
"./shared": "./build/shared.js"
|
|
10
11
|
},
|
|
11
12
|
"typesVersions": {
|
|
12
13
|
"*": {
|
|
13
14
|
"wordpress-scripts-wrapper": [
|
|
14
15
|
"build/wordpress-scripts-wrapper.d.ts"
|
|
16
|
+
],
|
|
17
|
+
"shared": [
|
|
18
|
+
"build/shared.d.ts"
|
|
15
19
|
]
|
|
16
20
|
}
|
|
17
21
|
},
|
|
18
22
|
"devDependencies": {
|
|
19
23
|
"@plaudit/gutenberg-api-extensions": "^2.77.2",
|
|
20
24
|
"@types/browser-sync-webpack-plugin": "^2.2.5",
|
|
21
|
-
"@types/node": "^24.6.
|
|
25
|
+
"@types/node": "^24.6.1",
|
|
22
26
|
"@types/postcss-functions": "^4.0.4",
|
|
23
27
|
"@types/tapable": "^2.2.7",
|
|
24
28
|
"@types/webpack": "^5.28.5",
|
|
@@ -26,7 +30,7 @@
|
|
|
26
30
|
"postcss-load-config": "^4.0.2",
|
|
27
31
|
"postcss-loader": "^7.3.4",
|
|
28
32
|
"ts-node": "^10.9.2",
|
|
29
|
-
"typescript": "^5.9.
|
|
33
|
+
"typescript": "^5.9.3",
|
|
30
34
|
"webpack-bundle-analyzer": "^4.10.2"
|
|
31
35
|
},
|
|
32
36
|
"dependencies": {
|
|
@@ -35,8 +39,8 @@
|
|
|
35
39
|
"@plaudit/postcss-silent-extend": "^3.0.0",
|
|
36
40
|
"@plaudit/postcss-strip-units": "^3.0.0",
|
|
37
41
|
"@plaudit/postcss-variables": "^1.1.0",
|
|
38
|
-
"@wordpress/dependency-extraction-webpack-plugin": "^6.
|
|
39
|
-
"@wordpress/scripts": "^30.
|
|
42
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^6.32.0",
|
|
43
|
+
"@wordpress/scripts": "^30.25.0",
|
|
40
44
|
"autoprefixer": "^10.4.21",
|
|
41
45
|
"browser-sync": "^3.0.4",
|
|
42
46
|
"copy-webpack-plugin": "^10.2.4",
|