The plugin's version is a constant: no package.json among a site's public assets

pluginVersion() named package.json relative to its own module. A bundler takes such a file for an asset:
a Turbopack build of a site copied the plugin's whole package.json (dependency lists, scripts, the registry
and repository addresses; no secret) to /_next/static/media/package.<hash>.json, served to anyone. Webpack kept
it on the server side. The version now comes from src/version.ts (scripts/write-version.mjs, run by the
`version` script; a test fails when it differs from package.json). A smoke test of the built site: nothing
under .next/static is a package manifest.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 02:53:41 +01:00
co-authored by Claude Fable 5.2
parent bc0fa65fd7
commit 9a648b0498
6 changed files with 80 additions and 8 deletions
+2 -1
View File
@@ -127,7 +127,8 @@
"test:e2e": "playwright test",
"test:int": "vitest run",
"test:watch": "vitest",
"typecheck": "tsc --noEmit -p . && tsc -p test"
"typecheck": "tsc --noEmit -p . && tsc -p test",
"version": "node scripts/write-version.mjs && git add src/version.ts"
},
"dependencies": {
"busboy": "1.6.0",