@plaudit/webpack-extensions 2.87.0 → 2.87.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/CHANGELOG.md CHANGED
@@ -60,6 +60,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
60
60
  - Legacy PostCSS features that have been integrated into modern CSS
61
61
  - `@extends` support
62
62
 
63
+ ## [2.87.1] - 2026-03-17
64
+ ### Changed
65
+ - The `blockdir-loader.php` generation logic to use static wp_register_* calls like `plain-entrypoints-loader.php`
66
+
63
67
  ## [2.87.0] - 2026-03-16
64
68
  ### Added
65
69
  - Support for a directory-based `extensions` layout
@@ -22,6 +22,7 @@ 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 callRegisterFunction;
25
26
  private transformBlocks;
26
27
  private static extractAssetSource;
27
28
  private static convertToScriptHandles;
@@ -136,15 +136,23 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
136
136
  const finalizedMetadata = Object.fromEntries(Object.entries(metadata)
137
137
  .map(([key, value]) => {
138
138
  if (key === 'scriptHandles') {
139
- return [key, finalizedScriptHandles];
139
+ return [key, []];
140
140
  }
141
141
  if (key === 'styleHandles') {
142
- return [key, finalizedStyleHandles];
142
+ return [key, []];
143
+ }
144
+ if (key === 'scriptModuleHandles') {
145
+ return [key, []];
143
146
  }
144
147
  return [key, value];
145
148
  }));
146
149
  const writer = new php_writer_1.PHPWriter()
147
150
  .action("init", writer => {
151
+ const baseUriVar = new expressions_1.Var("base_uri");
152
+ writer.call("plaudit_webpack_extensions__resolve_base_uri", [expressions_1.Constants.__DIR__], { assignTo: baseUriVar });
153
+ this.callRegisterFunction('script', writer, baseUriVar, Object.entries(finalizedScriptHandles));
154
+ this.callRegisterFunction('style', writer, baseUriVar, Object.entries(finalizedStyleHandles));
155
+ this.callRegisterFunction('script_module', writer, baseUriVar, Object.entries(metadata.scriptModuleHandles));
148
156
  writer.call("\\Plaudit\\Common\\ACF\\BlockManager::autoloadSubfoldersV3", [
149
157
  expressions_1.Constants.__DIR__, // string $dir
150
158
  new expressions_1.EnclosedLiteral((0, shared_1.makeEmittableConfigPHP)(blockData, false, "\t")), // array $blockdirConfig
@@ -165,6 +173,11 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
165
173
  compilation.emitAsset(node_path_1.default.join(this.dest.destination, "blockdir.config.php"), new webpack_1.sources.RawSource((0, shared_1.makeEmittableConfigPHP)(blockDirConfig, true)));
166
174
  }
167
175
  }
176
+ callRegisterFunction(type, writer, baseUriVar, handles) {
177
+ for (const [name, { src, rest }] of handles) {
178
+ writer.call(`wp_register_${type}`, [name, src === false ? false : expressions_1.Op.concat(baseUriVar, src), ...rest]);
179
+ }
180
+ }
168
181
  transformBlocks(compilation, collatedWorkableBlockInfo, emittingWpmlXml) {
169
182
  const handleData = Object.values(collatedWorkableBlockInfo)
170
183
  .flatMap(bi => bi.workableBlockEntrypointsInfo)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.87.0",
3
+ "version": "2.87.1",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "files": [
6
6
  "/build",