@plaudit/webpack-extensions 2.24.2 → 2.25.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.
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const node_crypto_1 = __importDefault(require("node:crypto"));
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
- const webpack_1 = require("webpack");
10
9
  const php_serializer_1 = __importDefault(require("./php-serializer"));
10
+ const webpack_1 = require("webpack");
11
11
  class BlockJSONManagingPlugin {
12
12
  standaloneBlocks;
13
13
  processingModules;
@@ -143,10 +143,11 @@ class BlockJSONManagingPlugin {
143
143
  delete json["acf"]["render_template"];
144
144
  }
145
145
  }
146
+ const blockName = json["name"]?.toString() || "non-existent/block-name";
146
147
  let rawRenderTemplate = json["render"] ?? json["render_template"];
147
148
  rawRenderTemplate = (rawRenderTemplate
148
149
  ? (typeof rawRenderTemplate === 'string' ? [rawRenderTemplate] : rawRenderTemplate)
149
- : ["template.php", "template.twig"]);
150
+ : [`${blockName.substring(blockName.indexOf('/') + 1)}.php`, "template.php", "template.twig"]);
150
151
  const renderTemplate = pathsNeedRemapping
151
152
  ? rawRenderTemplate
152
153
  .map(p => node_path_1.default.normalize(node_path_1.default.join(sourceDir, stripFilePrefix(p))))
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = phpSerialize;
3
4
  function phpSerialize(value, objectsAsArrays = true) {
4
5
  switch (typeof value) {
5
6
  case "undefined":
@@ -31,7 +32,6 @@ function phpSerialize(value, objectsAsArrays = true) {
31
32
  return `i:${value};`;
32
33
  }
33
34
  }
34
- exports.default = phpSerialize;
35
35
  function entriesInArrayAndObjectFormat(prefix, entries, objectsAsArrays) {
36
36
  let res = `${prefix}:${entries.length}:{`;
37
37
  for (const [k, v] of entries) {
@@ -1,3 +1,3 @@
1
1
  import type { Options as PostcssFunctionsOptions } from "postcss-functions";
2
2
  import type { PostCSSLoaderOptions } from "postcss-loader/dist/config";
3
- export declare function postcssConfigBuilder(verbose: boolean, variables: (name: string) => string | undefined, postCSSFunctions: (variables: (name: string) => unknown) => PostcssFunctionsOptions): PostCSSLoaderOptions;
3
+ export declare function postcssConfigBuilder(verbose: boolean, variables: (name: string) => string | undefined, postCSSFunctions: (variables: (name: string) => unknown) => PostcssFunctionsOptions['functions']): PostCSSLoaderOptions;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.postcssConfigBuilder = void 0;
6
+ exports.postcssConfigBuilder = postcssConfigBuilder;
7
7
  const cssnano_1 = __importDefault(require("cssnano"));
8
8
  // Options: calc
9
9
  const calcOptions = { precision: 4, mediaQueries: true, selectors: true };
@@ -92,4 +92,3 @@ function postcssConfigBuilder(verbose, variables, postCSSFunctions) {
92
92
  ]
93
93
  };
94
94
  }
95
- exports.postcssConfigBuilder = postcssConfigBuilder;
@@ -13,7 +13,7 @@ type PlauditWordpressWebpackConfig = {
13
13
  src: string[] | Record<string, string | AdvancedOutputConfig>;
14
14
  stats?: Configuration['stats'];
15
15
  postcss?: {
16
- functions?: (variables: (name: string) => unknown) => PostcssFunctionsOptions;
16
+ functions?: (variables: (name: string) => unknown) => PostcssFunctionsOptions['functions'];
17
17
  };
18
18
  };
19
19
  declare const _default: (config: PlauditWordpressWebpackConfig, webpackConfig?: Configuration[] | Configuration) => Configuration[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.24.2",
3
+ "version": "2.25.1",
4
4
  "scripts": {
5
5
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
6
6
  "build": "tsc",
@@ -21,15 +21,15 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/browser-sync-webpack-plugin": "^2.2.5",
24
- "@types/postcss-functions": "^4.0.3",
25
- "@types/node": "^20.12.12",
24
+ "@types/postcss-functions": "^4.0.4",
25
+ "@types/node": "^20.14.10",
26
26
  "@types/tapable": "^2.2.7",
27
27
  "@types/webpack": "^5.28.5",
28
28
  "@types/webpack-sources": "^3.2.3",
29
29
  "postcss-load-config": "^4.0.2",
30
30
  "postcss-loader": "^7.3.4",
31
31
  "ts-node": "^10.9.2",
32
- "typescript": "^5.4.5"
32
+ "typescript": "^5.5.3"
33
33
  },
34
34
  "dependencies": {
35
35
  "@plaudit/postcss-color-function": "^5.0.0",
@@ -45,8 +45,8 @@
45
45
  "eslint": "^8.57.0",
46
46
  "eslint-plugin-jsdoc": "^48.2.3",
47
47
  "fork-ts-checker-webpack-plugin": "^9.0.2",
48
- "http-proxy-middleware": "^3.0.0-beta.1",
49
- "postcss": "^8.4.38",
48
+ "http-proxy-middleware": "^3.0.1-beta.0",
49
+ "postcss": "^8.4.39",
50
50
  "postcss-calc": "^9.0.1",
51
51
  "postcss-discard-comments": "^6.0.2",
52
52
  "postcss-fallback": "^0.1.0",
@@ -64,9 +64,9 @@
64
64
  "postcss-short-spacing": "^4.0.0",
65
65
  "postcss-simple-vars": "^7.0.1",
66
66
  "postcss-url": "^10.1.3",
67
- "react": "^18.2.0",
68
- "react-dom": "^18.2.0",
69
- "webpack": "^5.91.0",
67
+ "react": "^18.3.1",
68
+ "react-dom": "^18.3.1",
69
+ "webpack": "^5.92.1",
70
70
  "webpack-remove-empty-scripts": "^1.0.4"
71
71
  }
72
72
  }