@plaudit/webpack-extensions 2.4.0 → 2.5.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.
@@ -1,4 +1,4 @@
1
- import type { Compiler, WebpackPluginInstance } from "webpack";
1
+ import { type Compiler, type WebpackPluginInstance } from "webpack";
2
2
  export default class BlockJSONStyleRemappingPlugin implements WebpackPluginInstance {
3
3
  private readonly standaloneBlocks;
4
4
  constructor(standaloneBlocks: boolean);
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const node_fs_1 = __importDefault(require("node:fs"));
7
7
  const node_path_1 = __importDefault(require("node:path"));
8
- const webpack_sources_1 = require("webpack-sources");
8
+ const webpack_1 = require("webpack");
9
9
  class BlockJSONStyleRemappingPlugin {
10
10
  standaloneBlocks;
11
11
  constructor(standaloneBlocks) {
@@ -62,7 +62,7 @@ class BlockJSONStyleRemappingPlugin {
62
62
  for (const [name, asset] of Object.entries(compilationAssets)) {
63
63
  if (name.endsWith("block.json") && asset.constructor.name === 'RawSource') {
64
64
  const dirname = node_path_1.default.dirname(assetSourceFiles.get(name) ?? name);
65
- const json = JSON.parse(asset.source());
65
+ const json = JSON.parse(asset.source().toString());
66
66
  for (const mappableKey of mappableKeys) {
67
67
  if (mappableKey in json) {
68
68
  const unmappedValue = json[mappableKey];
@@ -122,7 +122,7 @@ class BlockJSONStyleRemappingPlugin {
122
122
  delete json["render_template"];
123
123
  }
124
124
  }
125
- compilation.updateAsset(name, new webpack_sources_1.RawSource(JSON.stringify(json, undefined, " ")));
125
+ compilation.updateAsset(name, new webpack_1.sources.RawSource(JSON.stringify(json, undefined, " ")));
126
126
  }
127
127
  }
128
128
  });
@@ -141,7 +141,6 @@ class BlockJSONStyleRemappingPlugin {
141
141
  findRelativeRouteBetween(path1, path2) {
142
142
  const commonAncestor = this.findCommonAncestor(path1, path2);
143
143
  const route = Array(path1.split(node_path_1.default.sep).length - commonAncestor.length).fill("..");
144
- `..${node_path_1.default.sep}`.repeat(path1.split(node_path_1.default.sep).length - commonAncestor.length);
145
144
  route.push(node_path_1.default.relative(commonAncestor.join(node_path_1.default.sep), path2));
146
145
  return route.join(node_path_1.default.sep);
147
146
  }
@@ -74,6 +74,7 @@ function postcssConfigBuilder(verbose, variables) {
74
74
  require("postcss-media-minmax")(),
75
75
  require("postcss-inline-svg")(),
76
76
  require("postcss-nested")(),
77
+ require("postcss-url")(),
77
78
  require("postcss-calc")(calcOptions),
78
79
  require("@plaudit/postcss-color-function")(),
79
80
  require("autoprefixer")(autoprefixerOptions),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.4.0",
3
+ "version": "2.5.1",
4
4
  "scripts": {
5
5
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
6
6
  "build": "tsc",
@@ -28,7 +28,7 @@
28
28
  "@plaudit/postcss-silent-extend": "^3.0.0",
29
29
  "@plaudit/postcss-strip-units": "^3.0.0",
30
30
  "@plaudit/postcss-variables": "^1.0.0",
31
- "@wordpress/scripts": "^26.6.0",
31
+ "@wordpress/scripts": "^26.7.0",
32
32
  "autoprefixer": "^10.4.14",
33
33
  "browser-sync": "^2.29.3",
34
34
  "browser-sync-webpack-plugin": "^2.3.0",
@@ -54,6 +54,7 @@
54
54
  "postcss-short-size": "^4.0.0",
55
55
  "postcss-short-spacing": "^4.0.0",
56
56
  "postcss-simple-vars": "^7.0.1",
57
+ "postcss-url": "^10.1.3",
57
58
  "react": "^18.2.0",
58
59
  "react-dom": "^18.2.0",
59
60
  "webpack": "^5.88.1",