@plaudit/webpack-extensions 3.13.0 → 3.14.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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ 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.14.0] - 2026-07-15
|
|
9
|
+
### Added
|
|
10
|
+
- Logic to emit code that makes the supported features declared in block.json file the defaults for those blocks in the "theme.json" file
|
|
11
|
+
- This uses filters to achieve the "defaulting", which means that it's plugin and theme agnostic
|
|
12
|
+
- This comes from version `2.92.4`
|
|
13
|
+
- The `useBlockSupportsAsThemeJsonDefaults` flag to allow the new logic to be disabled
|
|
14
|
+
- This comes from version `2.92.4`
|
|
15
|
+
|
|
8
16
|
## [3.13.0] - 2026-07-14
|
|
9
17
|
### Added
|
|
10
18
|
- Support for using some "experimental" properties early (primarily `border`)
|
|
@@ -196,6 +204,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
196
204
|
- Legacy PostCSS features that have been integrated into modern CSS
|
|
197
205
|
- `@extends` support
|
|
198
206
|
|
|
207
|
+
## [2.93.0] - 2026-07-15
|
|
208
|
+
### Added
|
|
209
|
+
- Logic to emit code that makes the supported features declared in block.json file the defaults for those blocks in the "theme.json" file
|
|
210
|
+
- This uses filters to achieve the "defaulting", which means that it's plugin and theme agnostic
|
|
211
|
+
- The `useBlockSupportsAsThemeJsonDefaults` flag to allow the new logic to be disabled
|
|
212
|
+
|
|
199
213
|
## [2.92.4] - 2026-06-10
|
|
200
214
|
### Fixed
|
|
201
215
|
- Libraries externalizing in a way that does not account for the variable potentially being undeclared
|
|
@@ -22,6 +22,8 @@ export declare class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEnt
|
|
|
22
22
|
constructor(config: VerifiedPlauditWordpressWebpackConfig, dest: VerifiedAdvancedOutputConfig, webpackRemoveEmptyScriptsPlugin: WebpackRemoveEmptyScriptsPlugin, context: string, entry: EntryProvider<BlockEntrypointInfo>);
|
|
23
23
|
protected processAssets(compilation: Compilation, parsedAssetJsonProvider: ParsedAssetJsonProvider): Promise<void>;
|
|
24
24
|
private emitBlockLoaderFile;
|
|
25
|
+
private static readonly IGNORED_THEME_JSON_FLAG_PROPS;
|
|
26
|
+
private static pickOutFlagPropsFromBlockSupports;
|
|
25
27
|
private callRegisterFunction;
|
|
26
28
|
private transformBlocks;
|
|
27
29
|
private static extractAssetSource;
|
|
@@ -196,12 +196,57 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
196
196
|
(0, shared_1.appendAddInlineAssetCall)(compilation, writer, ...inlinableStyle);
|
|
197
197
|
}
|
|
198
198
|
}, { accountForAlreadyDoing: this.config.includePostInitFallback });
|
|
199
|
+
if (this.config.useBlockSupportsAsThemeJsonDefaults) {
|
|
200
|
+
const copyableBlockSupports = [];
|
|
201
|
+
for (const { name, supports } of Object.values(blockData)) {
|
|
202
|
+
if (typeof name === 'string' && !!name && typeof supports === 'object' && !!supports && !Array.isArray(supports)) {
|
|
203
|
+
const flagProps = EnhancedBlockJSONPlugin.pickOutFlagPropsFromBlockSupports(supports);
|
|
204
|
+
if (flagProps) {
|
|
205
|
+
copyableBlockSupports.push([name, flagProps]);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (copyableBlockSupports.length > 0) {
|
|
210
|
+
const themeJsonBlockSettings = new expressions_1.EnclosedLiteral((0, shared_1.makeEmittableConfigPHP)({
|
|
211
|
+
version: 3,
|
|
212
|
+
settings: {
|
|
213
|
+
blocks: Object.fromEntries(copyableBlockSupports)
|
|
214
|
+
}
|
|
215
|
+
}, false, "\t"));
|
|
216
|
+
const theme_json = new expressions_1.Var("theme_json");
|
|
217
|
+
writer.filter('wp_theme_json_data_blocks', writer => {
|
|
218
|
+
const updateCall = new expressions_1.Call(expressions_1.Literal.of("update_with", true), [themeJsonBlockSettings]);
|
|
219
|
+
writer.appendExpr(new expressions_1.InstanceAccess(theme_json, [updateCall]), { return: true });
|
|
220
|
+
}, { functionArgParameters: [theme_json] });
|
|
221
|
+
}
|
|
222
|
+
}
|
|
199
223
|
(0, shared_1.emitPHPWriterAsAsset)(writer, compilation, (0, node_path_1.join)(this.dest.destination, "blockdir-loader.php"));
|
|
200
224
|
}
|
|
201
225
|
else {
|
|
202
226
|
compilation.emitAsset((0, node_path_1.join)(this.dest.destination, "blockdir.config.php"), new webpack_1.sources.RawSource((0, shared_1.makeEmittableConfigPHP)(blockDirConfig, true)));
|
|
203
227
|
}
|
|
204
228
|
}
|
|
229
|
+
// This isn't strictly necessary, but it allows us to trivially eliminate commonly-used block supports flags that aren't used in theme.json
|
|
230
|
+
static IGNORED_THEME_JSON_FLAG_PROPS = ['align', 'alignWide', 'anchor', 'contentRole', 'interactivity', 'listView', 'plaudit'];
|
|
231
|
+
static pickOutFlagPropsFromBlockSupports(supports) {
|
|
232
|
+
const entries = [];
|
|
233
|
+
for (const [key, value] of Object.entries(supports)) {
|
|
234
|
+
if (!key.startsWith("__") && !EnhancedBlockJSONPlugin.IGNORED_THEME_JSON_FLAG_PROPS.includes(key) && value) {
|
|
235
|
+
if (typeof value === 'object') {
|
|
236
|
+
if (!Array.isArray(value)) {
|
|
237
|
+
const v = EnhancedBlockJSONPlugin.pickOutFlagPropsFromBlockSupports(value);
|
|
238
|
+
if (v !== undefined) {
|
|
239
|
+
entries.push([key, v]);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else if (typeof value === 'boolean') {
|
|
244
|
+
entries.push([key, true]);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
249
|
+
}
|
|
205
250
|
callRegisterFunction(type, writer, baseUriVar, handles) {
|
|
206
251
|
for (const [name, { src, rest }] of handles) {
|
|
207
252
|
writer.call(`wp_register_${type}`, [name, src === false ? false : expressions_1.Op.concat(baseUriVar, src), ...rest]);
|
package/dist/shared.d.ts
CHANGED
|
@@ -150,6 +150,7 @@ export type PlauditWordpressWebpackConfig = {
|
|
|
150
150
|
omitDistDev?: boolean;
|
|
151
151
|
onlyRunPostCSSOnPCSS?: boolean;
|
|
152
152
|
targetNamespace?: string;
|
|
153
|
+
useBlockSupportsAsThemeJsonDefaults?: boolean;
|
|
153
154
|
};
|
|
154
155
|
export declare function applyStandards(config: PlauditWordpressWebpackConfig): {
|
|
155
156
|
readonly standard?: "2026-03-13";
|
|
@@ -177,6 +178,7 @@ export declare function applyStandards(config: PlauditWordpressWebpackConfig): {
|
|
|
177
178
|
readonly omitDistDev?: boolean;
|
|
178
179
|
onlyRunPostCSSOnPCSS?: boolean;
|
|
179
180
|
readonly targetNamespace?: string;
|
|
181
|
+
readonly useBlockSupportsAsThemeJsonDefaults?: boolean;
|
|
180
182
|
};
|
|
181
183
|
export declare function resolveStandard(standard: PlauditWordpressWebpackConfig['standard']): {
|
|
182
184
|
readonly useWebpackResourceFiltering: true;
|
|
@@ -167,7 +167,7 @@ function injectSupportForInliningSVGsAsStrings(rules) {
|
|
|
167
167
|
}
|
|
168
168
|
function buildVerifiedConfig(config) {
|
|
169
169
|
config = (0, shared_1.applyStandards)(config);
|
|
170
|
-
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, plainEntrypointsVersion = 1, srcDir = "", useUnifiedLoader = false, includePostInitFallback = false, omitDistDev = false, onlyRunPostCSSOnPCSS = false } = config;
|
|
170
|
+
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, plainEntrypointsVersion = 1, srcDir = "", useUnifiedLoader = false, includePostInitFallback = false, omitDistDev = false, onlyRunPostCSSOnPCSS = false, useBlockSupportsAsThemeJsonDefaults = true, } = config;
|
|
171
171
|
let outputDir = config.outputDir ?? "";
|
|
172
172
|
if (outputDir && useUnifiedLoader && !omitDistDev && (process.env['SERVER_MODE'] ?? 'development') === 'development') {
|
|
173
173
|
outputDir += "-dev";
|
|
@@ -207,7 +207,7 @@ function buildVerifiedConfig(config) {
|
|
|
207
207
|
const cfg = {
|
|
208
208
|
currentVariables, postcss, standaloneBlocks, stats, variablesFilePath, verbose, externals, assumeGlobalizedPlauditLibraries, processTranslationConfigs, combineAssetMetadata,
|
|
209
209
|
useWebpackResourceFiltering, outputDir, extensionsVersion, plainEntrypointsVersion, srcDir, srcPrefixes, targetHandlePrefix, useUnifiedLoader, includePostInitFallback, omitDistDev,
|
|
210
|
-
onlyRunPostCSSOnPCSS, targetNamespace
|
|
210
|
+
onlyRunPostCSSOnPCSS, targetNamespace, useBlockSupportsAsThemeJsonDefaults
|
|
211
211
|
};
|
|
212
212
|
// Destination -> source map
|
|
213
213
|
const allocatedDestinations = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"files": [
|
|
6
6
|
"/dist",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"@plaudit/postcss-color-function": "^5.1.0",
|
|
47
47
|
"@plaudit/postcss-strip-units": "^3.0.0",
|
|
48
48
|
"@plaudit/postcss-variables": "^2.0.1",
|
|
49
|
-
"@wordpress/dependency-extraction-webpack-plugin": "^6.
|
|
49
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^6.51.0",
|
|
50
50
|
"@wordpress/scripts": "^32.6.0",
|
|
51
|
-
"autoprefixer": "^10.5.
|
|
51
|
+
"autoprefixer": "^10.5.3",
|
|
52
52
|
"browser-sync": "^3.0.4",
|
|
53
53
|
"copy-webpack-plugin": "10.2.4",
|
|
54
54
|
"css-minimizer-webpack-plugin": "^8.0.0",
|