@ideasonpurpose/build-tools-wordpress 2.2.3 → 2.2.5

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
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### v2.2.4
8
+
9
+ > 10 September 2025
10
+
11
+ - Make iop-format-prettier work globally
12
+
13
+ #### v2.2.3
14
+
15
+ > 9 September 2025
16
+
17
+ - trying explicit PHP plugin loading
18
+
7
19
  #### v2.2.2
8
20
 
9
21
  > 9 September 2025
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ideasonpurpose/build-tools-wordpress
2
2
 
3
- #### Version 2.2.3
3
+ #### Version 2.2.5
4
4
 
5
5
  [![NPM Version](https://img.shields.io/npm/v/%40ideasonpurpose%2Fbuild-tools-wordpress?logo=npm)](https://www.npmjs.com/package/@ideasonpurpose/build-tools-wordpress)
6
6
  [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ideasonpurpose/build-tools-wordpress/npm-publish.yml?logo=github&logoColor=white)](https://github.com/ideasonpurpose/build-tools-wordpress#readme)
@@ -11,8 +11,10 @@
11
11
  import prettier from "prettier";
12
12
  import prettierConfig from "@ideasonpurpose/prettier-config" with { type: "json" };
13
13
 
14
- // Add dynamic import for the plugin
15
- const phpPlugin = (await import("@prettier/plugin-php")).default;
14
+ const phpPlugin = await import("@prettier/plugin-php");
15
+
16
+ // Explicitly reset the plugin because global installs can't resolve it
17
+ prettierConfig.plugins = [phpPlugin];
16
18
 
17
19
  import { readFile, writeFile } from "fs/promises";
18
20
  import { resolve, basename } from "path";
@@ -56,7 +58,7 @@ const isInTag = (html, offset) => {
56
58
  */
57
59
  export function tokenizeHTML(htmlContent) {
58
60
  let tokenizedHTML = "";
59
- const phpCodeBlocks = {};
61
+ const phpCodeBlocks = new Map(); // Changed to Map for better performance and type safety
60
62
  let tokenCount = 0;
61
63
 
62
64
  /**
@@ -101,7 +103,7 @@ export function tokenizeHTML(htmlContent) {
101
103
  tokenizedHTML += htmlContent.slice(lastIndex, match.index);
102
104
 
103
105
  token = tokenizeCodeBlock(match[0], tokenizedHTML);
104
- phpCodeBlocks[token] = match[0];
106
+ phpCodeBlocks.set(token, match[0]);
105
107
  tokenizedHTML += token;
106
108
 
107
109
  lastIndex = match.index + match[0].length;
@@ -113,7 +115,7 @@ export function tokenizeHTML(htmlContent) {
113
115
 
114
116
  export function unTokenizeHTML(tokenizedHTML, phpCodeBlocks) {
115
117
  let phpContent = tokenizedHTML;
116
- for (const token in phpCodeBlocks) {
118
+ for (const [token, phpBlock] of phpCodeBlocks) {
117
119
  /**
118
120
  * Create a pattern from token that matches whitespace breaks resulting
119
121
  * from Prettier's HTML formatting, usually on very long lines.
@@ -123,7 +125,7 @@ export function unTokenizeHTML(tokenizedHTML, phpCodeBlocks) {
123
125
  const regexToken = new RegExp(token.replace("_ />", "_\\s+\\/>"), "g");
124
126
  phpContent = phpContent.replace(
125
127
  regexToken,
126
- phpCodeBlocks[token].replace(/\$/g, "$$$$"),
128
+ phpBlock.replace(/\$/g, "$$$$"),
127
129
  );
128
130
  }
129
131
  return phpContent;
@@ -160,7 +162,7 @@ async function formatHTMLThenPHP(filepath) {
160
162
  ...phpOptions,
161
163
  parser: "php",
162
164
  embeddedLanguageFormatting: "auto",
163
- plugins: [phpPlugin], // Explicitly pass the plugin
165
+ // plugins: [phpPlugin], // Explicitly pass the plugin
164
166
  });
165
167
 
166
168
  await writeFile(filepath, phpFormatted, "utf8");
@@ -49,6 +49,8 @@ services:
49
49
  - 9003
50
50
 
51
51
  # Link external plugin projects by defining host:container path pairs in .env
52
+ # An example .env entry looks like this:
53
+ # IOP_DEV_PLUGIN_1="../iop-data-model/:/var/www/html/wp-content/plugins/iop-data-model"
52
54
  environment:
53
55
  IOP_DEV_PLUGIN_1:
54
56
  IOP_DEV_PLUGIN_2:
@@ -58,6 +60,8 @@ services:
58
60
  IOP_DEV_PLUGIN_6:
59
61
  IOP_DEV_PLUGIN_7:
60
62
  IOP_DEV_PLUGIN_8:
63
+ WP_ENVIRONMENT_TYPE:
64
+ WP_MULTISITE:
61
65
 
62
66
  # Apache will throw errors for any ulimit value below 8192
63
67
  # NOTE THAT THIS MIGHT BE MORE THAN THE SYSTEM OFFERS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ideasonpurpose/build-tools-wordpress",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "Build scripts and dependencies for IOP's WordPress development environments.",
5
5
  "homepage": "https://github.com/ideasonpurpose/build-tools-wordpress#readme",
6
6
  "bugs": {
@@ -34,41 +34,41 @@
34
34
  "prettier": "@ideasonpurpose/prettier-config",
35
35
  "dependencies": {
36
36
  "@ideasonpurpose/prettier-config": "^1.0.1",
37
- "@ideasonpurpose/stylelint-config": "^1.1.1",
37
+ "@ideasonpurpose/stylelint-config": "^1.1.4",
38
38
  "@prettier/plugin-php": "^0.24.0",
39
39
  "@rollup/plugin-commonjs": "^28.0.6",
40
40
  "@rollup/plugin-json": "^6.1.0",
41
- "@rollup/plugin-node-resolve": "^16.0.1",
41
+ "@rollup/plugin-node-resolve": "^16.0.2",
42
42
  "@svgr/webpack": "^8.1.0",
43
- "@wordpress/dependency-extraction-webpack-plugin": "^6.30.0",
43
+ "@wordpress/dependency-extraction-webpack-plugin": "^6.32.0",
44
44
  "ansi-html": "^0.0.9",
45
45
  "archiver": "^7.0.1",
46
46
  "auto-changelog": "^2.5.0",
47
47
  "autoprefixer": "^10.4.21",
48
48
  "babel-loader": "^10.0.0",
49
- "caniuse-lite": "^1.0.30001741",
49
+ "caniuse-lite": "^1.0.30001748",
50
50
  "chalk": "^5.6.2",
51
51
  "chalk-cli": "^6.0.0",
52
52
  "classnames": "^2.5.1",
53
- "cli-truncate": "^5.0.0",
53
+ "cli-truncate": "^5.1.0",
54
54
  "copy-webpack-plugin": "^13.0.1",
55
55
  "cosmiconfig": "^9.0.0",
56
- "cross-env": "^10.0.0",
56
+ "cross-env": "^10.1.0",
57
57
  "css-loader": "^7.1.2",
58
58
  "cssnano": "^7.1.1",
59
- "dotenv": "^17.2.2",
60
- "esbuild-loader": "^4.3.0",
61
- "eslint": "^9.35.0",
62
- "filesize": "^11.0.2",
63
- "fs-extra": "^11.3.1",
64
- "globby": "^14.1.0",
59
+ "dotenv": "^17.2.3",
60
+ "esbuild-loader": "^4.4.0",
61
+ "eslint": "^9.37.0",
62
+ "filesize": "^11.0.13",
63
+ "fs-extra": "^11.3.2",
64
+ "globby": "^15.0.0",
65
65
  "http-proxy": "^1.18.1",
66
- "humanize-duration": "^3.33.0",
66
+ "humanize-duration": "^3.33.1",
67
67
  "image-minimizer-webpack-plugin": "^4.1.4",
68
68
  "is-text-path": "^3.0.0",
69
69
  "lodash": "^4.17.21",
70
70
  "mini-css-extract-plugin": "^2.9.4",
71
- "ora": "^8.2.0",
71
+ "ora": "^9.0.0",
72
72
  "postcss": "^8.5.6",
73
73
  "postcss-loader": "^8.2.0",
74
74
  "postcss-scss": "^4.0.9",
@@ -76,19 +76,19 @@
76
76
  "pretty-hrtime": "^1.0.3",
77
77
  "read-package-up": "^11.0.0",
78
78
  "replacestream": "^4.0.3",
79
- "sass-embedded": "^1.92.1",
79
+ "sass-embedded": "^1.93.2",
80
80
  "sass-loader": "^16.0.5",
81
81
  "semver": "^7.7.2",
82
- "sharp": "^0.34.3",
82
+ "sharp": "^0.34.4",
83
83
  "sort-package-json": "^3.4.0",
84
84
  "string-length": "^6.0.0",
85
85
  "style-loader": "^4.0.0",
86
86
  "svgo": "^4.0.0",
87
87
  "svgo-loader": "^4.0.0",
88
88
  "version-everything": "^0.11.4",
89
- "webpack": "^5.101.3",
89
+ "webpack": "^5.102.0",
90
90
  "webpack-bundle-analyzer": "^4.10.2",
91
- "webpack-dev-middleware": "^7.4.3",
91
+ "webpack-dev-middleware": "^7.4.5",
92
92
  "webpack-dev-server": "^5.2.2"
93
93
  },
94
94
  "peerDependencies": {
@@ -34,9 +34,9 @@ describe("HTML-PHP Prettier", () => {
34
34
  await readFile("./test/fixtures/format-php-prettier/basic-html.php")
35
35
  ).toString();
36
36
 
37
- const { phpCodeBlocks: codeBlocks } = tokenizeHTML(input);
37
+ const { phpCodeBlocks } = tokenizeHTML(input);
38
38
 
39
- const tokens = Object.keys(codeBlocks);
39
+ const tokens = Array.from(phpCodeBlocks.keys());
40
40
 
41
41
  expect(tokens[0]).toMatch(/^<php_\d+_* \/>$/);
42
42
  expect(tokens[1]).toMatch(/^_php_\d+_*$/);
@@ -51,9 +51,9 @@ describe("HTML-PHP Prettier", () => {
51
51
  )
52
52
  ).toString();
53
53
 
54
- const { phpCodeBlocks: codeBlocks } = tokenizeHTML(input);
54
+ const { phpCodeBlocks } = tokenizeHTML(input);
55
55
 
56
- const tokens = Object.keys(codeBlocks);
56
+ const tokens = Array.from(phpCodeBlocks.keys());
57
57
 
58
58
  expect(tokens).toHaveLength(1);
59
59
  });
@@ -69,7 +69,8 @@ describe("HTML-PHP Prettier", () => {
69
69
 
70
70
  // console.log({input, tokenizedHTML})
71
71
 
72
- const tokens = Object.keys(phpCodeBlocks);
72
+ // const tokens = Object.keys(phpCodeBlocks);
73
+ const tokens = Array.from(phpCodeBlocks.keys());
73
74
 
74
75
  expect(tokens[0]).toMatch(/^_php_\d+_*$/);
75
76
  expect(tokens[1]).toMatch(/^_php_\d+_*$/);
@@ -141,8 +142,8 @@ describe("HTML-PHP Prettier", () => {
141
142
 
142
143
  expect(tokenizedHTML).toContain("<php_0____ />");
143
144
  expect(tokenizedHTML).toContain("<php_1____ />");
144
- expect(phpCodeBlocks).toHaveProperty("<php_0____ />");
145
- expect(phpCodeBlocks).toHaveProperty("<php_1____ />");
145
+ expect(phpCodeBlocks.has("<php_0____ />")).toBe(true);
146
+ expect(phpCodeBlocks.has("<php_1____ />")).toBe(true);
146
147
  });
147
148
 
148
149
  /**