@plaudit/webpack-extensions 2.25.3 → 2.27.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,6 +49,7 @@ class ExtensionsConfigFileGeneratorPlugin {
49
49
  if (!stats.modules) {
50
50
  throw new Error("Stats did not include modules despite them being requested");
51
51
  }
52
+ const regex = /^(.+?)-((?:editor-|view-|)(?:style|script|script-module))\.(?:css|m?js)$/i;
52
53
  const mapping = {};
53
54
  for (const asset of stats.assets) {
54
55
  if ((asset.chunks?.length ?? -1) > 1 || !asset.size) {
@@ -58,21 +59,9 @@ class ExtensionsConfigFileGeneratorPlugin {
58
59
  if ((match = /^(.+?)-setup.php$/i.exec(asset.name)) && match[1]) {
59
60
  (mapping[match[1]] ?? (mapping[match[1]] = [{}]))[1] = `${asset.name}`;
60
61
  }
61
- else if ((match = /^(.+?)-(editor-style|style|view-script|editor-script|script)\.(?:css|m?js)$/i.exec(asset.name)) && match[1] && match[2]) {
62
+ else if ((match = regex.exec(asset.name)) && match[1] && match[2]) {
62
63
  const resourceInfo = (mapping[match[1]] ?? (mapping[match[1]] = [{}]))[0];
63
- let key;
64
- if (match[2] === "editor-script") {
65
- key = "editorScript";
66
- }
67
- else if (match[2] === "view-script") {
68
- key = "viewScript";
69
- }
70
- else if (match[2] === "editor-style") {
71
- key = "editorStyle";
72
- }
73
- else {
74
- key = match[2];
75
- }
64
+ const key = match[2].replace(/-[sm]/gi, chars => chars.substring(1).toUpperCase());
76
65
  (resourceInfo[key] ?? (resourceInfo[key] = [])).push([`plaudit_block-extension_${match[1]}-${match[2]}`, asset.name]);
77
66
  }
78
67
  }
@@ -222,7 +222,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources) {
222
222
  }
223
223
  else {
224
224
  scriptExtension = scriptWithoutModuleExtension;
225
- entrypointFields = ["editorStyle", "style", "editorScript", "viewScript", "script"];
225
+ entrypointFields = ["editorStyle", "viewStyle", "style", "editorScript", "viewScript", "script"];
226
226
  }
227
227
  const { standaloneBlocks, variablesFilePath, verbose } = config;
228
228
  let currentVariables = config.currentVariables;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.25.3",
3
+ "version": "2.27.0",
4
4
  "scripts": {
5
5
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
6
6
  "build": "tsc",