@ubean/integrations 0.2.0
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/LICENSE +21 -0
- package/dist/electron/index.d.ts +37 -0
- package/dist/electron/index.js +61 -0
- package/dist/fonts/index.d.ts +43 -0
- package/dist/fonts/index.js +103 -0
- package/dist/index.d.ts +301 -0
- package/dist/index.js +148 -0
- package/dist/pinia/index.d.ts +16 -0
- package/dist/pinia/index.js +30 -0
- package/dist/pwa/index.d.ts +47 -0
- package/dist/pwa/index.js +159 -0
- package/dist/runtime-C_0lCtWE.js +349 -0
- package/dist/types-BXiJV3cm.d.ts +37 -0
- package/dist/types-BsgAJnWk.d.ts +40 -0
- package/dist/types-CpVZH81i.d.ts +106 -0
- package/dist/types-D94CeRo-.d.ts +130 -0
- package/dist/types-Qd7x9Fbj.d.ts +52 -0
- package/dist/ui/index.d.ts +26 -0
- package/dist/ui/index.js +44 -0
- package/package.json +82 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/pinia/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* @ubean/integrations/pinia 类型定义
|
|
4
|
+
*
|
|
5
|
+
* Pinia 集成模块的配置选项与运行时类型。
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Pinia 模块配置选项
|
|
9
|
+
*
|
|
10
|
+
* 用户在 `ubean.config.ts` 中通过 `pinia: true | UbeanPiniaOptions` 配置。
|
|
11
|
+
* `pinia: true` 即可启用,默认开启 Vite 预构建优化。
|
|
12
|
+
*
|
|
13
|
+
* 注意:`pinia: true` 仅启用 Vite 插件(dev 预构建优化),
|
|
14
|
+
* 用户仍需在 `src/app.ts` 中通过 `defineApp` 注册 `createPinia()` 插件
|
|
15
|
+
* 和 `serializePiniaState` / `hydratePiniaState` 钩子以启用 SSR 状态水合。
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* // ubean.config.ts — 最简启用
|
|
20
|
+
* export default defineConfig({ pinia: true });
|
|
21
|
+
*
|
|
22
|
+
* // 显式配置
|
|
23
|
+
* export default defineConfig({
|
|
24
|
+
* pinia: { optimizeDeps: true }
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
interface UbeanPiniaOptions {
|
|
29
|
+
/** 是否启用,默认 true。设为 false 等价于 `pinia: false` */
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 是否将 `pinia` 加入 Vite 的 `optimizeDeps.include`,默认 true。
|
|
33
|
+
*
|
|
34
|
+
* dev 模式下预构建 pinia 可避免首次请求的依赖扫描延迟。
|
|
35
|
+
* 若你使用了自定义的 pinia 别名或 monorepo 内的 pinia 源码,可设为 false。
|
|
36
|
+
*/
|
|
37
|
+
optimizeDeps?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* SSR 序列化的 state 对象形状。
|
|
41
|
+
*
|
|
42
|
+
* `serializePiniaState` 返回此对象,`hydratePiniaState` 接收此对象。
|
|
43
|
+
* `pinia` 字段对应 `pinia.state.value`。
|
|
44
|
+
*/
|
|
45
|
+
interface PiniaSerializedState {
|
|
46
|
+
/** Pinia 的 root state(`pinia.state.value`) */
|
|
47
|
+
pinia?: Record<string, unknown>;
|
|
48
|
+
/** 允许扩展自定义字段 */
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { UbeanPiniaOptions as n, PiniaSerializedState as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { t as UiOptions } from "../types-BXiJV3cm.js";
|
|
2
|
+
import { Plugin } from "vite";
|
|
3
|
+
//#region src/ui/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* ubean UI Vite 插件(@soybeanjs/ui 集成)
|
|
6
|
+
*
|
|
7
|
+
* `ui: true` 即可启用,默认自动注入 styles.css + UiResolver。
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* // ubean.config.ts — 最简启用
|
|
12
|
+
* export default defineConfig({ ui: true });
|
|
13
|
+
*
|
|
14
|
+
* // ubean.config.ts — UnoCSS 模式(不注入 styles.css)
|
|
15
|
+
* export default defineConfig({ ui: { css: false } });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* 通常由 ubean module 系统自动加载,无需在 vite.config.ts 中手动调用。
|
|
19
|
+
*/
|
|
20
|
+
declare function ubeanUiPlugin(options?: UiOptions): Plugin[];
|
|
21
|
+
/**
|
|
22
|
+
* 类型安全的 UI 配置定义辅助函数(透传)
|
|
23
|
+
*/
|
|
24
|
+
declare function defineUiConfig(options: UiOptions): UiOptions;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { type UiOptions, ubeanUiPlugin as default, ubeanUiPlugin, defineUiConfig };
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import UiResolver from "@soybeanjs/ui/resolver";
|
|
2
|
+
import { registerComponentResolver, registerCssImport } from "@ubean/build";
|
|
3
|
+
//#region src/ui/index.ts
|
|
4
|
+
/** @soybeanjs/ui 预构建样式路径 */
|
|
5
|
+
const SOYBEAN_UI_STYLES = "@soybeanjs/ui/styles.css";
|
|
6
|
+
/**
|
|
7
|
+
* ubean UI Vite 插件(@soybeanjs/ui 集成)
|
|
8
|
+
*
|
|
9
|
+
* `ui: true` 即可启用,默认自动注入 styles.css + UiResolver。
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* // ubean.config.ts — 最简启用
|
|
14
|
+
* export default defineConfig({ ui: true });
|
|
15
|
+
*
|
|
16
|
+
* // ubean.config.ts — UnoCSS 模式(不注入 styles.css)
|
|
17
|
+
* export default defineConfig({ ui: { css: false } });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* 通常由 ubean module 系统自动加载,无需在 vite.config.ts 中手动调用。
|
|
21
|
+
*/
|
|
22
|
+
function ubeanUiPlugin(options = {}) {
|
|
23
|
+
if (options.enabled === false) return [{
|
|
24
|
+
name: "ubean:ui:noop",
|
|
25
|
+
enforce: "post"
|
|
26
|
+
}];
|
|
27
|
+
registerComponentResolver(UiResolver());
|
|
28
|
+
if (options.css !== false) registerCssImport(SOYBEAN_UI_STYLES);
|
|
29
|
+
return [{
|
|
30
|
+
name: "ubean:ui",
|
|
31
|
+
enforce: "pre",
|
|
32
|
+
config() {
|
|
33
|
+
return { optimizeDeps: { include: ["@soybeanjs/ui"] } };
|
|
34
|
+
}
|
|
35
|
+
}];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 类型安全的 UI 配置定义辅助函数(透传)
|
|
39
|
+
*/
|
|
40
|
+
function defineUiConfig(options) {
|
|
41
|
+
return options;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { ubeanUiPlugin as default, ubeanUiPlugin, defineUiConfig };
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ubean/integrations",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Thin integration bundles for ubean (pwa, fonts, electron, ui, pinia)",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./pwa": {
|
|
18
|
+
"types": "./dist/pwa/index.d.ts",
|
|
19
|
+
"import": "./dist/pwa/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./fonts": {
|
|
22
|
+
"types": "./dist/fonts/index.d.ts",
|
|
23
|
+
"import": "./dist/fonts/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./electron": {
|
|
26
|
+
"types": "./dist/electron/index.d.ts",
|
|
27
|
+
"import": "./dist/electron/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./ui": {
|
|
30
|
+
"types": "./dist/ui/index.d.ts",
|
|
31
|
+
"import": "./dist/ui/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./pinia": {
|
|
34
|
+
"types": "./dist/pinia/index.d.ts",
|
|
35
|
+
"import": "./dist/pinia/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"defu": "6.1.7",
|
|
40
|
+
"ohash": "^2.0.12",
|
|
41
|
+
"vite-plugin-electron": "^1.1.1",
|
|
42
|
+
"vite-plugin-pwa": "^1.3.0",
|
|
43
|
+
"@ubean/build": "0.2.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^26.2.0",
|
|
47
|
+
"typescript": "7.0.2",
|
|
48
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.2.9",
|
|
49
|
+
"vite-plus": "0.2.9",
|
|
50
|
+
"vue": "^3.5.41"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@soybeanjs/ui": ">=0.29.0",
|
|
54
|
+
"electron": "^28.0.0 || ^29.0.0 || ^30.0.0 || ^31.0.0 || ^32.0.0 || ^33.0.0 || ^34.0.0 || ^35.0.0 || ^36.0.0 || ^37.0.0",
|
|
55
|
+
"pinia": "^2.0.0 || ^3.0.0",
|
|
56
|
+
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
57
|
+
"vue": "^3.0.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"@soybeanjs/ui": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"electron": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"pinia": {
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"vite": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"vue": {
|
|
73
|
+
"optional": true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "vp pack",
|
|
78
|
+
"dev": "vp pack --watch",
|
|
79
|
+
"test": "vp test",
|
|
80
|
+
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
81
|
+
}
|
|
82
|
+
}
|