Skip to content

Commit 854412a

Browse files
fix: pin @wp-playground/blueprints to exact version (#3260)
## Related issues Follow-up to #3254. ## How AI was used in this PR Fix identified by Claude while investigating a 455 MB app size regression shown in CodeVitals on trunk. ## Proposed Changes Pins `@wp-playground/blueprints` to an exact version in all `package.json` files, consistent with how all other Playground/PHP-WASM packages are already pinned. **Root cause of the regression:** `^3.1.20` on blueprints meant that when 3.1.21 published to npm, `install:bundle` (which runs `npm install --no-workspaces` inside `apps/cli`) resolved blueprints to 3.1.21. That version of blueprints depends on `@php-wasm/node@3.1.21`, but `apps/cli/package.json` pinned `@php-wasm/node@3.1.20` — so npm installed **both** versions, with the 3.1.21 copies nested under `blueprints/node_modules/`. The `prune-php-wasm` vite plugin only globs top-level `@php-wasm/node-*/asyncify/` paths, so the nested copies (8 PHP versions × ~58 MB each) were never pruned, adding ~466 MB to the app bundle. ## Testing Instructions - CodeVitals app-size should stay at ~1450 MB, not jump to ~1907 MB after the next Playground release ## Pre-merge Checklist - [ ] Have you checked for TypeScript, React or other console errors? --------- Co-authored-by: Fredrik Rombach Ekelund <fredrik.rombach.ekelund@automattic.com>
1 parent 2f95352 commit 854412a

6 files changed

Lines changed: 10 additions & 15 deletions

File tree

.github/dependabot.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ updates:
2525
- dependency-name: "wpcom"
2626
- dependency-name: "wpcom-*"
2727

28-
# WordPress Playground & PHP WASM
29-
- dependency-name: "@wp-playground/*"
30-
- dependency-name: "@php-wasm/*"
31-
3228
# TypeScript ecosystem
3329
- dependency-name: "typescript"
3430
- dependency-name: "typescript-*"
@@ -165,11 +161,6 @@ updates:
165161
- "electron-playwright-helpers"
166162
- "electron-devtools-installer"
167163

168-
wp-playground-php-wasm:
169-
patterns:
170-
- "@wp-playground/*"
171-
- "@php-wasm/*"
172-
173164
wordpress:
174165
patterns:
175166
- "@wordpress/*"
@@ -279,6 +270,8 @@ updates:
279270
- dependency-name: "eslint-plugin-studio"
280271
- dependency-name: "winreg" # v1.2.5 has a known issue: https://github.com/fresc81/node-winreg/issues/65
281272
- dependency-name: "@types/glob" # glob@7 (transitive) has no bundled types; @types/glob@9 is a stub for glob@9+ only
273+
- dependency-name: "@wp-playground/*" # must be pinned exactly and bumped manually in lockstep — version mismatches cause runtime failures and ~450 MB bundle bloat
274+
- dependency-name: "@php-wasm/*" # must be pinned exactly and bumped manually in lockstep — version mismatches cause runtime failures and ~450 MB bundle bloat
282275

283276
# Enable version updates for GitHub Actions
284277
- package-ecosystem: "github-actions"

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ If you've built a substantial new feature — especially one generated with AI a
109109

110110
**Port Conflicts**: Site servers dynamically allocate ports. Don't hardcode port numbers; use the port-finder utility.
111111

112+
**CRITICAL - Playground/PHP-WASM Package Versions**: Always pin `@wp-playground/*` and `@php-wasm/*` packages to **exact versions** (no `^` or `~` ranges) in all `package.json` files. A caret range causes `install:bundle` to resolve a newer version when one publishes, creating a version conflict. npm then installs duplicate copies of all PHP WASM packages nested under the conflicting package's `node_modules/`. The `prune-php-wasm` vite plugin only removes top-level asyncify directories and misses nested copies, resulting in ~450 MB of bloat in the app bundle. More critically, different parts of Studio end up running mismatched Playground/PHP-WASM versions, which can cause subtle and hard-to-diagnose runtime failures in core site operations.
113+
112114
## Detailed Documentation
113115

114116
For in-depth information, see these docs:

apps/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"@php-wasm/util": "3.1.21",
3434
"@vscode/sudo-prompt": "^9.3.2",
3535
"@wordpress/i18n": "^6.14.0",
36-
"@wp-playground/blueprints": "^3.1.21",
36+
"@wp-playground/blueprints": "3.1.21",
3737
"@wp-playground/cli": "3.1.21",
3838
"@wp-playground/common": "3.1.21",
3939
"@wp-playground/storage": "3.1.21",

apps/studio/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"@types/winreg": "^1.2.36",
9898
"@types/yauzl": "^2.10.3",
9999
"@vitejs/plugin-react": "^5.1.4",
100-
"@wp-playground/blueprints": "^3.1.21",
100+
"@wp-playground/blueprints": "3.1.21",
101101
"electron": "^41.3.0",
102102
"electron-devtools-installer": "^4.0.0",
103103
"electron-vite": "^5.0.0",

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
"devDependencies": {
2424
"@types/lockfile": "^1.0.4",
2525
"@types/yauzl": "^2.10.3",
26-
"@wp-playground/blueprints": "^3.1.21"
26+
"@wp-playground/blueprints": "3.1.21"
2727
}
2828
}

0 commit comments

Comments
 (0)