labull-framework 0.1.29 → 0.1.30
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 +9 -3
- package/dist/auth.js +6 -5
- package/dist/{chunk-index-DGTXheeR.js → chunk-index-3dQJWK2S.js} +194 -193
- package/dist/{chunk-index-BWpDbB19.js → chunk-index-BVIJeFeJ.js} +34 -29
- package/dist/index.js +27 -26
- package/dist/magic-block.js +492 -490
- package/dist/style.css +1 -1
- package/dist/types/auth-real.d.ts +8 -1
- package/dist/types/magic-block-real.d.ts +1 -1
- package/dist/types/ui-real.d.ts +10 -0
- package/dist/ui.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,20 +80,26 @@ const tab = await magicBlock.context() // { path, params, que
|
|
|
80
80
|
await magicBlock.setTabTitle('订单 SO-42', 'pi pi-file') // 给所属那条标签起名
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
后端地址:**默认相对本站**(空串)。跨源部署时由**宿主**在自己的入口里给一次 ——
|
|
84
|
+
`app.use(labull, { apiBase: import.meta.env.VITE_API_BASE })`,或者 `setApiBase('https://api.你的域名')`。
|
|
85
|
+
|
|
86
|
+
🔴 **别让库去读 `import.meta.env`**:这个包发布的是**预编译 dist**,而 `import.meta.env.*` 是 Vite 在
|
|
87
|
+
**构建时**做的静态替换 —— 库构建那一刻没设这个变量 ⇒ 它被换成字面量烧进产物,你的 `.env` 再也
|
|
88
|
+
覆盖不了(0.1.29 及以前就是这样:产物里烧死 `http://localhost:3000`,登录之后所有接口打到
|
|
89
|
+
**访问者自己那台机器**)。那一句读法必须写在**你自己的源码**里,替换才会发生在**你的**构建里。
|
|
84
90
|
|
|
85
91
|
## subpath 对照表(原包 → 现在怎么 import)
|
|
86
92
|
|
|
87
93
|
| 原来 | 现在 | 内容 |
|
|
88
94
|
|---|---|---|
|
|
89
95
|
| `@labull/theme` | `labull-framework/style.css`(或 `labull-framework/theme`) | `--sp-*` token + 完整主题层 + 结构类 + primeicons |
|
|
90
|
-
| `@labull/auth` | `labull-framework/auth` | `useAuth()` / `apiFetch()` / `ensureAuthenticated()` / `createAuthGate()` / `API_BASE
|
|
96
|
+
| `@labull/auth` | `labull-framework/auth` | `useAuth()` / `apiFetch()` / `ensureAuthenticated()` / `createAuthGate()` / `setApiBase()`(后端地址,**运行期**给)/ `API_BASE`(当前值,活绑定) |
|
|
91
97
|
| `@labull/ui` | `labull-framework/ui` | `ProductShell` / `ProductSide` / `ProductTabs` / `TabPage` / `AppSearch` / `UserMenu` / `labull` 插件,以及标签那一套:`openTab` / `activateTab` / `closeTab` / `useTabs` / `useTabContext` |
|
|
92
98
|
| `@labull/magic-block` | `labull-framework/magic-block` | `MagicBlockPage`(一条路由 = 一个块,**唯一入口**) / `MagicBlockConsole` / 清单校验 / bridge |
|
|
93
99
|
|
|
94
100
|
根入口 `labull-framework` = `auth` + `ui`(最常用的两层)。
|
|
95
101
|
|
|
96
|
-
🔴 **它故意不 re-export `magic-block`**:`magic-block` 与 `auth` 都导出 `API_BASE
|
|
102
|
+
🔴 **它故意不 re-export `magic-block`**:`magic-block` 与 `auth` 都导出 `API_BASE`(以及 `setApiBase`),
|
|
97
103
|
两路 `export *` 撞同一个名字是打包器层面的歧义。要块就从 `labull-framework/magic-block` 拿。
|
|
98
104
|
|
|
99
105
|
## 两份东西要知道
|
package/dist/auth.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { A as s, a as t, C as r, b as u, c as A, d as
|
|
1
|
+
import { A as s, a as t, C as r, b as u, c as A, d as i, e as c, f as h, g as n, h as E, l as o, i as S, j as _, s as l, u as I } from "./chunk-index-BVIJeFeJ.js";
|
|
2
2
|
export {
|
|
3
3
|
s as API_BASE,
|
|
4
4
|
t as AUTH_DEADLINE_MS,
|
|
5
5
|
r as CLEAR_SESSION_DEADLINE_MS,
|
|
6
6
|
u as apiFetch,
|
|
7
7
|
A as authHeaders,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
i as createAuthGate,
|
|
9
|
+
c as currentPath,
|
|
10
|
+
h as currentUser,
|
|
11
11
|
n as currentUserInTime,
|
|
12
12
|
E as ensureAuthenticated,
|
|
13
13
|
o as loginUrl,
|
|
14
14
|
S as loginWithRedirect,
|
|
15
15
|
_ as logout,
|
|
16
|
-
l as
|
|
16
|
+
l as setApiBase,
|
|
17
|
+
I as useAuth
|
|
17
18
|
};
|