@plaudit/webpack-extensions 3.8.0 → 3.9.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,11 @@ 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.9.0] - 2026-05-20
|
|
9
|
+
### Added
|
|
10
|
+
- Support for marking `block.json` attributes with `"supports-bindings": true` to enable block binding support in the editor
|
|
11
|
+
- This comes from version `2.92.0`
|
|
12
|
+
|
|
8
13
|
## [3.8.0] - 2026-05-20
|
|
9
14
|
### Added
|
|
10
15
|
- Support for the `module_dependencies` property on `script` assets
|
|
@@ -122,6 +127,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
122
127
|
- Legacy PostCSS features that have been integrated into modern CSS
|
|
123
128
|
- `@extends` support
|
|
124
129
|
|
|
130
|
+
## [2.92.0] - 2026-05-20
|
|
131
|
+
### Added
|
|
132
|
+
- Support for marking `block.json` attributes with `"supports-bindings": true` to enable block binding support in the editor
|
|
133
|
+
|
|
125
134
|
## [2.91.0] - 2026-05-20
|
|
126
135
|
### Added
|
|
127
136
|
- Support for the `module_dependencies` property on `script` assets
|
|
@@ -155,6 +155,33 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
155
155
|
this.callRegisterFunction('script', writer, baseUriVar, Object.entries(finalizedScriptHandles));
|
|
156
156
|
this.callRegisterFunction('style', writer, baseUriVar, Object.entries(finalizedStyleHandles));
|
|
157
157
|
this.callRegisterFunction('script_module', writer, baseUriVar, Object.entries(metadata.scriptModuleHandles));
|
|
158
|
+
const entries = Object.entries(metadata.bindableBlockAttributes);
|
|
159
|
+
const supportedAttributes = new expressions_1.Var("supported_block_attributes", "?array");
|
|
160
|
+
if ((0, shared_1.arrayIsLength)(entries, 1)) {
|
|
161
|
+
writer.filter(`block_bindings_supported_attributes_${entries[0][0]}`, writer => {
|
|
162
|
+
const parameters = entries[0][1];
|
|
163
|
+
if (parameters.length === 1) {
|
|
164
|
+
writer.appendExpr(new expressions_1.Assignment(supportedAttributes, parameters[0], true));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
writer.call("array_push", [supportedAttributes, ...parameters]);
|
|
168
|
+
}
|
|
169
|
+
writer.return(supportedAttributes);
|
|
170
|
+
}, { functionArgParameters: [supportedAttributes] });
|
|
171
|
+
}
|
|
172
|
+
else if (entries.length > 1) {
|
|
173
|
+
const compiledBindingSupportingAttributes = new expressions_1.Var("compiled_binding_supporting_attributes");
|
|
174
|
+
writer.assign(compiledBindingSupportingAttributes, metadata.bindableBlockAttributes);
|
|
175
|
+
const blockType = new expressions_1.Var("block_type", "?string");
|
|
176
|
+
writer.filter(`block_bindings_supported_attributes`, writer => {
|
|
177
|
+
writer
|
|
178
|
+
.if(expressions_1.Op.binary(new expressions_1.Call("empty", [blockType]), " || ", new expressions_1.Call("empty", [new expressions_1.ArrayAccess(compiledBindingSupportingAttributes, blockType)])))
|
|
179
|
+
.return(supportedAttributes)
|
|
180
|
+
.endIf()
|
|
181
|
+
.call("array_push", [supportedAttributes, new expressions_1.Op("...", new expressions_1.ArrayAccess(compiledBindingSupportingAttributes, blockType))])
|
|
182
|
+
.return(supportedAttributes);
|
|
183
|
+
}, { functionArgParameters: [supportedAttributes, blockType], useVars: [compiledBindingSupportingAttributes] });
|
|
184
|
+
}
|
|
158
185
|
writer.call("\\Plaudit\\Common\\ACF\\BlockManager::autoloadSubfoldersV3", [
|
|
159
186
|
expressions_1.Constants.__DIR__, // string $dir
|
|
160
187
|
new expressions_1.EnclosedLiteral((0, shared_1.makeEmittableConfigPHP)(blockData, false, "\t")), // array $blockdirConfig
|
|
@@ -185,6 +212,7 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
185
212
|
.flatMap(bi => bi.workableBlockEntrypointsInfo)
|
|
186
213
|
.sort((a, b) => a.handle.localeCompare(b.handle) || a.entrypointField.localeCompare(b.entrypointField));
|
|
187
214
|
const blockData = {};
|
|
215
|
+
const bindableBlockAttributes = {};
|
|
188
216
|
for (const [blockJsonAssetName, { sourcePath: blockJsonSourcePath, workableBlockEntrypointsInfo, blockJsonText }] of Object.entries(collatedWorkableBlockInfo)) {
|
|
189
217
|
if (!blockJsonSourcePath) {
|
|
190
218
|
compilation.errors.push((0, shared_1.newWebpackErrorForFile)(`${blockJsonAssetName} does not have a source path`, blockJsonAssetName));
|
|
@@ -208,6 +236,19 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
208
236
|
else {
|
|
209
237
|
blockJson["version"] = hashForVersion;
|
|
210
238
|
}
|
|
239
|
+
if (typeof blockJson["name"] === 'string' && typeof blockJson["attributes"] === 'object' && blockJson["attributes"]) {
|
|
240
|
+
for (const [name, attr] of Object.entries(blockJson["attributes"])) {
|
|
241
|
+
if (attr["supports-bindings"]) {
|
|
242
|
+
delete attr["supports-bindings"];
|
|
243
|
+
if (bindableBlockAttributes[blockJson["name"]] !== undefined) {
|
|
244
|
+
bindableBlockAttributes[blockJson["name"]].push(name);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
bindableBlockAttributes[blockJson["name"]] = [name];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
211
252
|
EnhancedBlockJSONPlugin.normalizeRenderTemplate(blockJson, pathsNeedRemapping, sourceDir, outputDir, compilation);
|
|
212
253
|
const blockDirName = (0, node_path_1.dirname)((0, node_path_1.relative)(this.dest.destination, blockJsonAssetName));
|
|
213
254
|
blockData[blockDirName] = EnhancedBlockJSONPlugin
|
|
@@ -226,7 +267,8 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
226
267
|
styleHandles: Object.fromEntries(handleData.filter(hd => (0, shared_1.isStyleField)(hd.entrypointField))
|
|
227
268
|
.map(hd => {
|
|
228
269
|
return [hd.handle, { src: hd.outputPath, rest: [hd.originalValue !== undefined ? hd.assetData.dependencies : [], hd.assetData.version], inlinedAsset: hd.inlinedAsset }];
|
|
229
|
-
}))
|
|
270
|
+
})),
|
|
271
|
+
bindableBlockAttributes
|
|
230
272
|
},
|
|
231
273
|
...Object.fromEntries(Object.entries(blockData).sort((a, b) => a[0].localeCompare(b[0])))
|
|
232
274
|
};
|