@kne/fastify-app-manager 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -23,6 +23,8 @@ npm i --save @kne/fastify-app-manager
23
23
  适用场景:内网/堡垒机上的业务应用集中托管;不负责多机编排、硬磁盘配额或 WebSocket 升级。
24
24
 
25
25
  > **关键设计**:子应用前端通过部署时注入的 `runtimePublicUrl` / `runtimeApiUrl` 感知对外前缀;网关对路径模式剥前缀反代,并改写 Location / Cookie / 文本 body 兜底。Scheme B(子进程挂 `APP_BASE_PATH`)已弃用。
26
+ >
27
+ > **存储隔离**:同时注入 `window.__LOCAL_STORAGE_PREFIX="<应用名>"`,`@kne/local-storage`(≥0.1.2,`@kne/token-storage` 底层依赖)读到后自动给 key 加 `<应用名>:` 前缀,避免同源挂载的子应用与宿主、其它子应用互相覆盖登录 token 等本地存储。
26
28
 
27
29
  #### 核心架构与流程
28
30
 
@@ -60,7 +60,8 @@ const injectEntryHtml = async ({ buildDir, appName, publicUrl, apiUrl }) => {
60
60
  `window.runtimeAppName=${JSON.stringify(appName || '')};` +
61
61
  `window.runtimePublicUrl=${JSON.stringify(normalizedPublic)};` +
62
62
  `window.runtimeApiUrl=${JSON.stringify(normalizedApi)};` +
63
- `window.__webpack_public_path__=${JSON.stringify(publicPath)};`;
63
+ `window.__webpack_public_path__=${JSON.stringify(publicPath)};` +
64
+ `window.__LOCAL_STORAGE_PREFIX=${JSON.stringify(appName || '')};`;
64
65
  doc.head.insertBefore(scriptEl, doc.head.firstChild);
65
66
 
66
67
  await fs.writeFile(filePath, dom.serialize());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kne/fastify-app-manager",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Fastify 单机应用市场插件:版本上传、PM2 托管、路径/域名反代与日志 SSE",
5
5
  "main": "index.js",
6
6
  "scripts": {