@plaudit/webpack-extensions 2.68.1 → 2.70.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.
@@ -49,7 +49,7 @@ class ExtensionsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryP
49
49
  });
50
50
  }
51
51
  generateVersionThreeConfigFile(compilation, relevantAssetData, setupFilePaths) {
52
- const handlePrefix = `${this.config.plainEntrypointsHandlePrefix}_block-extensions`;
52
+ const handlePrefix = `${this.config.targetHandlePrefix}_block-extensions`;
53
53
  const regex = /^(.+?)-((?:editor-|view-|)(?:style|script|script-module))\.(?:css|m?js)$/i;
54
54
  const blockExtensionsConfig = {
55
55
  metadata: { version: this.config.extensionsVersion }, scriptHandles: {}, scriptModuleHandles: {}, styleHandles: {}, blocks: {}, setupFiles: {}
@@ -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: true });
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'))
@@ -188,7 +188,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
188
188
  handleName: useHandleName ? this.usageLocations.handle : undefined,
189
189
  });
190
190
  }
191
- myAssetHandles.push({ handles, handlePrefix: this.config.plainEntrypointsHandlePrefix });
191
+ myAssetHandles.push({ handles, handlePrefix: this.config.targetHandlePrefix });
192
192
  }
193
193
  PlainEntrypointsConfigFileGeneratorPlugin.semaphore.resolve(this.id, myAssetHandles);
194
194
  UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore.resolve(this.id, myAssetHandles.length
@@ -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: true })
108
+ }, { accountForAlreadyDoing: this.config.includePostInitFallback })
109
109
  .emitAsset(compilation, node_path_1.default.join(this.blocksDest, "blockdir-loader.php"));
110
110
  }
111
111
  else {
package/build/shared.d.ts CHANGED
@@ -98,11 +98,12 @@ export type PlauditWordpressWebpackConfig = {
98
98
  useWebpackResourceFiltering?: boolean;
99
99
  outputDir?: string;
100
100
  extensionsVersion?: 1 | 2 | 3;
101
- plainEntrypointsHandlePrefix?: string;
101
+ targetHandlePrefix?: string;
102
102
  plainEntrypointsVersion?: 1 | 2;
103
103
  srcDir?: string;
104
104
  srcPrefixes?: string[];
105
105
  useUnifiedLoader?: boolean;
106
+ includePostInitFallback?: boolean;
106
107
  };
107
108
  export type FileSegmentBlockEntrypointInfo = {
108
109
  blockJsonOrigin: string;
@@ -172,7 +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 = "", plainEntrypointsVersion = 1, srcDir = "", useUnifiedLoader = false } = 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 = "", plainEntrypointsVersion = 1, srcDir = "", useUnifiedLoader = false, includePostInitFallback = true } = config;
176
176
  let srcPrefixes;
177
177
  const trailingSlashedSrcDir = srcDir && !srcDir.endsWith("/") ? srcDir + "/" : srcDir;
178
178
  if (config.srcPrefixes === undefined) {
@@ -181,12 +181,12 @@ function buildVerifiedConfig(config) {
181
181
  else {
182
182
  srcPrefixes = (srcDir && !config.srcPrefixes.includes(trailingSlashedSrcDir) ? [...config.srcPrefixes, trailingSlashedSrcDir] : config.srcPrefixes);
183
183
  }
184
- let plainEntrypointsHandlePrefix = config.plainEntrypointsHandlePrefix ?? "";
184
+ let targetHandlePrefix = config.targetHandlePrefix ?? config.plainEntrypointsHandlePrefix ?? "";
185
185
  if (plainEntrypointsVersion > 1) {
186
- if (!plainEntrypointsHandlePrefix) {
187
- plainEntrypointsHandlePrefix = deriveDefaultHandlePrefixFromComposerJsonOrThemeName();
188
- if (!plainEntrypointsHandlePrefix) {
189
- throw new Error("Plain Entrypoints V2 and higher require either 'plainEntrypointsHandlePrefix' to be set or an adjacent composer.json or style.css file to be present");
186
+ if (!targetHandlePrefix) {
187
+ targetHandlePrefix = deriveDefaultHandlePrefixFromComposerJsonOrThemeName();
188
+ if (!targetHandlePrefix) {
189
+ throw new Error("Plain Entrypoints V2 and higher require either 'targetHandlePrefix' to be set or an adjacent composer.json or style.css file to be present");
190
190
  }
191
191
  }
192
192
  if (!outputDir) {
@@ -220,7 +220,7 @@ function buildVerifiedConfig(config) {
220
220
  }
221
221
  const cfg = {
222
222
  currentVariables, postcss, standaloneBlocks, stats, variablesFilePath, verbose, externals, assumeGlobalizedPlauditLibraries, processTranslationConfigs, combineAssetMetadata,
223
- useWebpackResourceFiltering, outputDir, extensionsVersion, plainEntrypointsVersion, plainEntrypointsHandlePrefix, srcDir, srcPrefixes, useUnifiedLoader
223
+ useWebpackResourceFiltering, outputDir, extensionsVersion, plainEntrypointsVersion, srcDir, srcPrefixes, targetHandlePrefix, useUnifiedLoader, includePostInitFallback
224
224
  };
225
225
  // Destination -> source map
226
226
  const allocatedDestinations = {};
@@ -309,7 +309,7 @@ function deriveDefaultHandlePrefixFromComposerJsonOrThemeName() {
309
309
  return deriveDefaultHandlePrefixFromThemeName();
310
310
  }
311
311
  if (typeof composerJson !== 'object' || typeof composerJson.name !== 'string' || !composerJson.name) {
312
- throw new ReferenceError("plainEntrypointsHandlePrefix was not set and the adjacent composer.json file does not have a valid name in it");
312
+ throw new ReferenceError("targetHandlePrefix was not set and the adjacent composer.json file does not have a valid name in it");
313
313
  }
314
314
  return (0, shared_1.kebabCase)(composerJson.name.replace(/plaudit\/plaudit/, 'plaudit'));
315
315
  }
@@ -317,7 +317,7 @@ function deriveDefaultHandlePrefixFromThemeName() {
317
317
  const styleFileContents = node_fs_1.default.readFileSync(node_path_1.default.join(process.cwd(), "style.css"), 'utf-8');
318
318
  const themeName = /^\W*Theme\s*Name:\s*(.+)$/im.exec(styleFileContents)?.[1]?.trim();
319
319
  if (!themeName) {
320
- throw new ReferenceError("plainEntrypointsHandlePrefix was not set and the adjacent style.css file does not have a valid name in it");
320
+ throw new ReferenceError("targetHandlePrefix was not set and the adjacent style.css file does not have a valid name in it");
321
321
  }
322
322
  return (0, shared_1.kebabCase)(themeName);
323
323
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.68.1",
3
+ "version": "2.70.0",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "files": [
6
6
  "/build"
@@ -16,9 +16,9 @@
16
16
  }
17
17
  },
18
18
  "devDependencies": {
19
- "@plaudit/gutenberg-api-extensions": "^2.77.0",
19
+ "@plaudit/gutenberg-api-extensions": "^2.77.2",
20
20
  "@types/browser-sync-webpack-plugin": "^2.2.5",
21
- "@types/node": "^24.5.2",
21
+ "@types/node": "^24.6.1",
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,7 @@
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.9.2",
29
+ "typescript": "^5.9.3",
30
30
  "webpack-bundle-analyzer": "^4.10.2"
31
31
  },
32
32
  "dependencies": {
@@ -35,8 +35,8 @@
35
35
  "@plaudit/postcss-silent-extend": "^3.0.0",
36
36
  "@plaudit/postcss-strip-units": "^3.0.0",
37
37
  "@plaudit/postcss-variables": "^1.1.0",
38
- "@wordpress/dependency-extraction-webpack-plugin": "^6.31.0",
39
- "@wordpress/scripts": "^30.24.0",
38
+ "@wordpress/dependency-extraction-webpack-plugin": "^6.32.0",
39
+ "@wordpress/scripts": "^30.25.0",
40
40
  "autoprefixer": "^10.4.21",
41
41
  "browser-sync": "^3.0.4",
42
42
  "copy-webpack-plugin": "^10.2.4",
@@ -59,7 +59,7 @@
59
59
  "postcss-url": "^10.1.3",
60
60
  "react": "^18.3.1",
61
61
  "react-dom": "^18.3.1",
62
- "webpack": "^5.101.3",
62
+ "webpack": "^5.102.0",
63
63
  "webpack-remove-empty-scripts": "^1.1.1",
64
64
  "xml-formatter": "^3.6.7"
65
65
  },