@lark-apaas/coding-preset-vite-react 0.1.1-alpha.0 → 0.1.1
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 +13 -0
- package/lib/index.d.ts +52 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +410 -0
- package/lib/index.js.map +1 -0
- package/lib/plugins/capabilities.d.ts +23 -0
- package/lib/plugins/capabilities.d.ts.map +1 -0
- package/lib/plugins/capabilities.js +151 -0
- package/lib/plugins/capabilities.js.map +1 -0
- package/lib/plugins/dev-logs.d.ts +44 -0
- package/lib/plugins/dev-logs.d.ts.map +1 -0
- package/lib/plugins/dev-logs.js +544 -0
- package/lib/plugins/dev-logs.js.map +1 -0
- package/lib/plugins/error-overlay.d.ts +19 -0
- package/lib/plugins/error-overlay.d.ts.map +1 -0
- package/lib/plugins/error-overlay.js +136 -0
- package/lib/plugins/error-overlay.js.map +1 -0
- package/lib/plugins/fonts-mirror.d.ts +14 -0
- package/lib/plugins/fonts-mirror.d.ts.map +1 -0
- package/lib/plugins/fonts-mirror.js +70 -0
- package/lib/plugins/fonts-mirror.js.map +1 -0
- package/lib/plugins/health.d.ts +19 -0
- package/lib/plugins/health.d.ts.map +1 -0
- package/lib/plugins/health.js +36 -0
- package/lib/plugins/health.js.map +1 -0
- package/lib/plugins/hmr-timing.d.ts +13 -0
- package/lib/plugins/hmr-timing.d.ts.map +1 -0
- package/lib/plugins/hmr-timing.js +93 -0
- package/lib/plugins/hmr-timing.js.map +1 -0
- package/lib/plugins/html-minify.d.ts +18 -0
- package/lib/plugins/html-minify.d.ts.map +1 -0
- package/lib/plugins/html-minify.js +100 -0
- package/lib/plugins/html-minify.js.map +1 -0
- package/lib/plugins/module-alias.d.ts +12 -0
- package/lib/plugins/module-alias.d.ts.map +1 -0
- package/lib/plugins/module-alias.js +78 -0
- package/lib/plugins/module-alias.js.map +1 -0
- package/lib/plugins/og-meta.d.ts +21 -0
- package/lib/plugins/og-meta.d.ts.map +1 -0
- package/lib/plugins/og-meta.js +60 -0
- package/lib/plugins/og-meta.js.map +1 -0
- package/lib/plugins/polyfill.d.ts +11 -0
- package/lib/plugins/polyfill.d.ts.map +1 -0
- package/lib/plugins/polyfill.js +140 -0
- package/lib/plugins/polyfill.js.map +1 -0
- package/lib/plugins/routes.d.ts +26 -0
- package/lib/plugins/routes.d.ts.map +1 -0
- package/lib/plugins/routes.js +265 -0
- package/lib/plugins/routes.js.map +1 -0
- package/lib/plugins/slardar.d.ts +24 -0
- package/lib/plugins/slardar.d.ts.map +1 -0
- package/lib/plugins/slardar.js +74 -0
- package/lib/plugins/slardar.js.map +1 -0
- package/lib/plugins/static-assets.d.ts +10 -0
- package/lib/plugins/static-assets.d.ts.map +1 -0
- package/lib/plugins/static-assets.js +307 -0
- package/lib/plugins/static-assets.js.map +1 -0
- package/lib/plugins/view-context.d.ts +22 -0
- package/lib/plugins/view-context.d.ts.map +1 -0
- package/lib/plugins/view-context.js +165 -0
- package/lib/plugins/view-context.js.map +1 -0
- package/lib/plugins/vite-client-patch.d.ts +4 -0
- package/lib/plugins/vite-client-patch.d.ts.map +1 -0
- package/lib/plugins/vite-client-patch.js +37 -0
- package/lib/plugins/vite-client-patch.js.map +1 -0
- package/lib/plugins/ws-watchdog.d.ts +22 -0
- package/lib/plugins/ws-watchdog.d.ts.map +1 -0
- package/lib/plugins/ws-watchdog.js +103 -0
- package/lib/plugins/ws-watchdog.js.map +1 -0
- package/lib/polyfills/index.d.ts +15 -0
- package/lib/polyfills/index.d.ts.map +1 -0
- package/lib/polyfills/index.js +36 -0
- package/lib/polyfills/index.js.map +1 -0
- package/lib/utils/normalize-base-path.d.ts +37 -0
- package/lib/utils/normalize-base-path.d.ts.map +1 -0
- package/lib/utils/normalize-base-path.js +57 -0
- package/lib/utils/normalize-base-path.js.map +1 -0
- package/lib/utils/snapdom-proxy.d.ts +12 -0
- package/lib/utils/snapdom-proxy.d.ts.map +1 -0
- package/lib/utils/snapdom-proxy.js +75 -0
- package/lib/utils/snapdom-proxy.js.map +1 -0
- package/package.json +9 -15
- package/dist/index.d.ts +0 -320
- package/dist/index.js +0 -1941
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { Plugin, Connect, UserConfig } from 'vite';
|
|
2
|
-
|
|
3
|
-
interface RoutesPluginOptions {
|
|
4
|
-
/** 应用入口路径(相对项目根)。默认按顺序探测 `src/app.tsx`、`client/src/app.tsx`。 */
|
|
5
|
-
appPath?: string;
|
|
6
|
-
/** 写入 routes.json 时给每条 path 的前缀。未传时回退到 `process.env.CLIENT_BASE_PATH`。 */
|
|
7
|
-
basePath?: string;
|
|
8
|
-
/** dev middleware 把 `/routes.json` 挂在哪个 URL 前缀下。未传时回退到 `process.env.CLIENT_BASE_PATH`。 */
|
|
9
|
-
serveBasePath?: string;
|
|
10
|
-
}
|
|
11
|
-
interface RouteEntry {
|
|
12
|
-
path: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* AST 解析 React Router 的 `<Route>` 元素,返回路由列表。
|
|
16
|
-
*
|
|
17
|
-
* 算法移植自 `@lark-apaas/devtool-kits` 的 `parseRoutesFromFile`:
|
|
18
|
-
* - `<Route path="..." />` / `path={'...'}` / `path={`...`}` 都识别
|
|
19
|
-
* - 嵌套 path 自动 join,子节点用绝对路径时覆盖
|
|
20
|
-
* - `<Route index>` 视作当前层级根
|
|
21
|
-
* - `path="*"` 通配符跳过
|
|
22
|
-
* - 表达式形如 `path={variable}` 时跳过(无法静态求值)
|
|
23
|
-
*/
|
|
24
|
-
declare function parseRoutes(source: string, basePath: string): RouteEntry[];
|
|
25
|
-
declare function routesPlugin(options?: RoutesPluginOptions): Plugin;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 压缩 HTML,同时保护 HBS(Handlebars)占位符。
|
|
29
|
-
*
|
|
30
|
-
* `{{csrfToken}}` / `{{{appAvatar}}}` 这类占位符是部署运行时(vefaas)替换的,
|
|
31
|
-
* 直接交给 html-minifier-terser 会被解析破坏。先把它们抽出来用 `__HBS_<i>__`
|
|
32
|
-
* 占位,压缩完再放回去。
|
|
33
|
-
*/
|
|
34
|
-
declare function minifyHtmlWithHbsProtection(html: string): Promise<string>;
|
|
35
|
-
/**
|
|
36
|
-
* 仅 build 期生效的 HTML 压缩插件。
|
|
37
|
-
*
|
|
38
|
-
* dev 期完全 no-op(不挂 hook、不读盘);
|
|
39
|
-
* build 完毕时(closeBundle)读 `outDir/index.html` 压缩后写回。
|
|
40
|
-
*/
|
|
41
|
-
declare function htmlMinifyPlugin(): Plugin;
|
|
42
|
-
|
|
43
|
-
interface StaticAssetsPluginOptions {
|
|
44
|
-
/** Client base path prefix for routes. */
|
|
45
|
-
clientBasePath?: string;
|
|
46
|
-
/** Project root directory. Defaults to `process.cwd()`. */
|
|
47
|
-
rootDir?: string;
|
|
48
|
-
}
|
|
49
|
-
declare function staticAssetsPlugin(options?: StaticAssetsPluginOptions): Plugin;
|
|
50
|
-
|
|
51
|
-
interface CapabilitiesBundlePluginOptions {
|
|
52
|
-
/** 覆盖扫描目录(相对项目根)。不传时按默认目录列表依次扫描。 */
|
|
53
|
-
dir?: string;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* 把业务工程 `<dir>/*.json` 的 capability 配置打成 `virtual:capabilities` 虚拟模块。
|
|
57
|
-
*
|
|
58
|
-
* `@lark-apaas/client-capability` SDK(被 client-toolkit-lite 内联使用)会
|
|
59
|
-
* `import map from 'virtual:capabilities'` 取这个 map。SDK 在 dev 预览 / 沙箱
|
|
60
|
-
* 加载流程中依赖这个模块存在,所以即使 capabilities 目录为空,也必须把模块
|
|
61
|
-
* 注册成解析成功(空 map),否则 rolldown 在 build 时直接 fail。
|
|
62
|
-
*
|
|
63
|
-
* 同时通过 `optimizeDeps.esbuildOptions.plugins` 在 depOptimizer 那条路径上
|
|
64
|
-
* 也提供解析——因为 client-toolkit-lite 是 pre-bundle 进来的,pre-bundle 的
|
|
65
|
-
* esbuild 不会经过 Vite 主 pipeline 的 plugin 链。
|
|
66
|
-
*
|
|
67
|
-
* V1 限制:dev 期更改 capability JSON 后,pre-bundle 产物里的 map 是启动时快照,
|
|
68
|
-
* 不会自动刷新;新增 / 修改 capability 后需要重启 dev server。
|
|
69
|
-
*/
|
|
70
|
-
declare function capabilitiesBundlePlugin(options?: CapabilitiesBundlePluginOptions): Plugin;
|
|
71
|
-
|
|
72
|
-
interface ErrorOverlayPluginOptions {
|
|
73
|
-
/** Whether to enable the error overlay. Default true. */
|
|
74
|
-
enabled?: boolean;
|
|
75
|
-
/** Client base path prefix. Default ''. */
|
|
76
|
-
clientBasePath?: string;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* 自定义 HMR error overlay。
|
|
80
|
-
*
|
|
81
|
-
* - 关掉 Vite 原生 overlay(`server.hmr.overlay = false`)
|
|
82
|
-
* - dev middleware 暴露 `/@error-overlay.js`(按 clientBasePath 加前缀)
|
|
83
|
-
* - HTML head 注入 `<script type="module" src="...">`
|
|
84
|
-
*
|
|
85
|
-
* 只在 dev 期生效;build 时整个 `configureServer` / `transformIndexHtml` 分支不触发。
|
|
86
|
-
*/
|
|
87
|
-
declare function errorOverlayPlugin(options?: ErrorOverlayPluginOptions): Plugin;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* HMR 计时插件(Vite 8+)。
|
|
91
|
-
*
|
|
92
|
-
* 监听文件变更记录起始时间,在 `hotUpdate` 钩子里算出耗时 + 文件数 + 累计大小,
|
|
93
|
-
* 通过 `server.hot.send({ type: 'custom', event: 'hmr-timing' })` 广播给浏览器;
|
|
94
|
-
* 浏览器侧由 inspector / dev panel 收消息展示。
|
|
95
|
-
*
|
|
96
|
-
* dev 期专用;build 完全不挂 hook。
|
|
97
|
-
*/
|
|
98
|
-
declare function hmrTimingPlugin(): Plugin;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* 检测沙箱代理链路下的 WebSocket 僵尸连接。
|
|
102
|
-
*
|
|
103
|
-
* 客户端 5s ping 一次(通过 vite hot.send),连续 2 次拿不到 pong 判死,
|
|
104
|
-
* 向 parent window 发 `postMessage({ type: 'disconnected' })` 通知沙箱外壳。
|
|
105
|
-
*
|
|
106
|
-
* 仅 dev 期生效(`apply: 'serve'`);本地裸 dev 也开,不会有副作用——
|
|
107
|
-
* parent 不是沙箱时 postMessage 无消费者,自然丢弃。
|
|
108
|
-
*/
|
|
109
|
-
interface WsWatchdogPluginOptions {
|
|
110
|
-
pingEvent?: string;
|
|
111
|
-
pongEvent?: string;
|
|
112
|
-
/**
|
|
113
|
-
* 客户端 base path(如 `/app/app_xxx`)。沙箱网关把完整路径透传给 Vite,
|
|
114
|
-
* middleware 匹配和注入的 `<script src>` 都必须带 base;空串退化到裸路径。
|
|
115
|
-
*/
|
|
116
|
-
clientBasePath?: string;
|
|
117
|
-
}
|
|
118
|
-
declare function wsWatchdogPlugin(options?: WsWatchdogPluginOptions): Plugin;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* 给妙搭沙箱外壳提供统一的 health endpoint。
|
|
122
|
-
*
|
|
123
|
-
* 协议(飞书文档 - 妙搭应用 Health Check 接口规范):
|
|
124
|
-
* - HTTP connection refused / timeout → dev server 没起来 → 外壳重启沙箱
|
|
125
|
-
* - 200 + { ready: true } → 应用已就绪
|
|
126
|
-
* - 200 + { ready: false } → 还在启动,按 error 描述判断重试
|
|
127
|
-
*
|
|
128
|
-
* 不归本接口管:
|
|
129
|
-
* - vite compile error / runtime error / 资源加载失败 → 浏览器侧自己上报
|
|
130
|
-
*/
|
|
131
|
-
interface HealthMiddlewarePluginOptions {
|
|
132
|
-
/** Health endpoint 路径,默认 `/dev/health`。 */
|
|
133
|
-
endpoint?: string;
|
|
134
|
-
}
|
|
135
|
-
declare function healthMiddlewarePlugin(options?: HealthMiddlewarePluginOptions): Plugin;
|
|
136
|
-
|
|
137
|
-
interface ViewContextPluginOptions {
|
|
138
|
-
/**
|
|
139
|
-
* 显式传入的 appId override。preset 已经从 `CLIENT_BASE_PATH=/app/<appId>`
|
|
140
|
-
* 提取,设置后 inline script 直接拼真值字面量。未设置则走 IIFE 从 URL
|
|
141
|
-
* 解析(prod / 部分本地 dev URL 没 base path 时用)。
|
|
142
|
-
*/
|
|
143
|
-
appId?: string;
|
|
144
|
-
}
|
|
145
|
-
declare function viewContextPlugin(options?: ViewContextPluginOptions): Plugin;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* 把业务工程里 `import 'clsx'` / `import 'echarts'` / `import 'echarts-for-react'`
|
|
149
|
-
* 这种裸 import 强制指向 preset 自带的 ESM wrapper(`src/module-alias/*.mjs`)。
|
|
150
|
-
*
|
|
151
|
-
* 解决的问题:第三方扩展(如 `echarts-wordcloud`)自带独立 echarts 副本时,
|
|
152
|
-
* 业务代码和扩展跑在两份 echarts 实例上,wordcloud 注册不到主实例 → 渲染丢失。
|
|
153
|
-
* Wrapper 强制所有 echarts 指针指向 preset 自带版本,全栈共用一份实例。
|
|
154
|
-
*/
|
|
155
|
-
declare function moduleAliasPlugin(): Plugin;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* 向 `index.html` 注入 / 改写 OG meta、title、description meta、favicon。
|
|
159
|
-
*
|
|
160
|
-
* 所有值用 HBS 占位符(`{{appName}}` 等),由部署运行时(vefaas)替换为
|
|
161
|
-
* platform API 拿到的真值;jsPage 流程下浏览器侧不直接消费这些 meta。
|
|
162
|
-
*
|
|
163
|
-
* 既存 tag 会被原地改写(保留其它属性),缺失则插入到 `</head>` 之前。
|
|
164
|
-
*/
|
|
165
|
-
interface OgMetaPluginOptions {
|
|
166
|
-
customTags?: Array<{
|
|
167
|
-
property: string;
|
|
168
|
-
placeholder: string;
|
|
169
|
-
}>;
|
|
170
|
-
titlePlaceholder?: string;
|
|
171
|
-
descriptionPlaceholder?: string;
|
|
172
|
-
faviconPlaceholder?: string;
|
|
173
|
-
}
|
|
174
|
-
declare function ogMetaPlugin(options?: OgMetaPluginOptions): Plugin;
|
|
175
|
-
|
|
176
|
-
interface FontsMirrorPluginOptions {
|
|
177
|
-
/** Mirror 完整基址,默认 `https://miaoda.feishu.cn/fonts` */
|
|
178
|
-
mirror?: string;
|
|
179
|
-
/** 关闭(调试时兜底) */
|
|
180
|
-
disabled?: boolean;
|
|
181
|
-
/** 命中时打 warning(便于找出源码里的旧引用) */
|
|
182
|
-
warnOnMatch?: boolean;
|
|
183
|
-
/** 排除 id 子串或正则 */
|
|
184
|
-
exclude?: (string | RegExp)[];
|
|
185
|
-
}
|
|
186
|
-
declare function fontsMirrorPlugin(options?: FontsMirrorPluginOptions): Plugin | false;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* 为旧版浏览器生成独立 `polyfills.js`,HTML 注入 detection 脚本按需加载。
|
|
190
|
-
* 现代浏览器不会请求该文件,零开销。
|
|
191
|
-
*
|
|
192
|
-
* 使用 Vite build API 二次 build 把 `src/polyfills/index.ts` 打成 IIFE bundle。
|
|
193
|
-
* 仅生产构建生效(`apply: 'build'`)。
|
|
194
|
-
*/
|
|
195
|
-
declare function polyfillPlugin(): Plugin;
|
|
196
|
-
|
|
197
|
-
declare function viteClientPatchPlugin(): Plugin;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* 注入 Slardar SDK + Performance + Tea 监控埋点。
|
|
201
|
-
*
|
|
202
|
-
* 三段都通过 `<script>` 注入到 head-prepend:
|
|
203
|
-
* 1. Slardar SDK loader(onload 后读 `window.tenantId/appId/userId/ENVIRONMENT` 初始化)
|
|
204
|
-
* 2. Performance SDK
|
|
205
|
-
* 3. Tea SDK loader
|
|
206
|
-
*
|
|
207
|
-
* 依赖 viewContextPlugin 提前注入 `window.tenantId/appId/userId/ENVIRONMENT`。
|
|
208
|
-
*
|
|
209
|
-
* head-prepend bucket:Vite 同 bucket 是"后执行者插更前"。
|
|
210
|
-
* 数组里 slardar 必须排在 viewContext **之前** —— 这样在 HTML 里 viewContext 出现在
|
|
211
|
-
* slardar 之上,slardar onload 时才能读到 window.tenantId 等真值。
|
|
212
|
-
*/
|
|
213
|
-
interface SlardarPluginOptions {
|
|
214
|
-
/** Business ID。默认 `apaas_miaoda` */
|
|
215
|
-
bid?: string;
|
|
216
|
-
/** SDK 暴露在 window 上的全局名。默认 `KSlardarWeb` */
|
|
217
|
-
globalName?: string;
|
|
218
|
-
}
|
|
219
|
-
declare function slardarPlugin(options?: SlardarPluginOptions): Plugin;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* 客户端日志收集 + 读取 + SSE 流式 endpoint。
|
|
223
|
-
*
|
|
224
|
-
* 写入:
|
|
225
|
-
* - `POST <basePath>/dev/logs/collect` 单条 log(`{ message, ... }`)
|
|
226
|
-
* - `POST <basePath>/dev/logs/collect-batch` 数组批量 log
|
|
227
|
-
*
|
|
228
|
-
* 读取:
|
|
229
|
-
* - `GET <basePath>/dev/logs/files/:fileName?page=1&pageSize=200`
|
|
230
|
-
* 倒序分页读 `<logDir>/<fileName>` 任意文件,防 path traversal,max pageSize 2000
|
|
231
|
-
* - `GET <basePath>/dev/logs/server-logs?limit=100&offset=0&levels=error,warn&sources=client-std`
|
|
232
|
-
* 合并 4 个常见日志文件(server.log / trace.log / server.std.log / client.std.log)
|
|
233
|
-
* 的 entries,按 timestamp desc 排序后分页 + 过滤
|
|
234
|
-
* - `GET <basePath>/dev/logs/server-logs/stream`(SSE)
|
|
235
|
-
* `LogWatcher` 增量监听 4 个文件,新行实时推送
|
|
236
|
-
*
|
|
237
|
-
* jsPage 说明:endpoint 名字带 "server-" 是历史遗留(与 `client-toolkit` 写死的路径
|
|
238
|
-
* 兼容,见 `client-toolkit/src/server-log/poller.ts`);实际只监测一个文件
|
|
239
|
-
* `client.std.log`(dev.mjs 写的)。上游另外那 3 个(`server.log`、`trace.log`、
|
|
240
|
-
* `server.std.log`)是 fullstack 后端的产物,jsPage 不产、也没消费者,全部砍掉。
|
|
241
|
-
*
|
|
242
|
-
* 写入路径:`<logDir>/<fileName>`(默认 `./logs/client.log`,由 `LOG_DIR` 环境变量改写)。
|
|
243
|
-
*
|
|
244
|
-
* 移植自上游 `@lark-apaas/devtool-kits` 的 `dev-logs` + `collect-logs` middlewares。
|
|
245
|
-
* 仍然不补的 fullstack-only endpoints:
|
|
246
|
-
* - `/app/trace/:traceId`、`/trace/recent`、`/trace/trigger/*`、`/trace/capability/list`
|
|
247
|
-
* —— 全是 server-side trace.log 的索引接口
|
|
248
|
-
* - `/api-list` —— 从 fullstack server 抓 API route 清单
|
|
249
|
-
* - `/health` —— 重复(本 preset 有独立 `/dev/health`)
|
|
250
|
-
*/
|
|
251
|
-
interface DevLogsPluginOptions {
|
|
252
|
-
/** 日志写入目录。默认 `process.env.LOG_DIR ?? './logs'`。 */
|
|
253
|
-
logDir?: string;
|
|
254
|
-
/** 日志文件名。默认 `client.log`。 */
|
|
255
|
-
fileName?: string;
|
|
256
|
-
/** Body 大小上限(bytes)。默认 20 MB。 */
|
|
257
|
-
bodyLimit?: number;
|
|
258
|
-
/** 接口基路径前缀(沙箱 base path)。默认空。 */
|
|
259
|
-
basePath?: string;
|
|
260
|
-
}
|
|
261
|
-
declare function devLogsPlugin(options?: DevLogsPluginOptions): Plugin;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* 标准化 base path:
|
|
265
|
-
* - 空 / undefined → 空字符串
|
|
266
|
-
* - 前面强制加 `/`
|
|
267
|
-
* - 去掉尾部 `/`
|
|
268
|
-
*
|
|
269
|
-
* 例:
|
|
270
|
-
* normalizeBasePath('') === ''
|
|
271
|
-
* normalizeBasePath('/') === ''
|
|
272
|
-
* normalizeBasePath('foo') === '/foo'
|
|
273
|
-
* normalizeBasePath('/foo/') === '/foo'
|
|
274
|
-
* normalizeBasePath('/app/x/') === '/app/x'
|
|
275
|
-
*/
|
|
276
|
-
declare function normalizeBasePath(input: string | undefined): string;
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* `/dev/snapdom-proxy?url=<encoded>` 转发到目标 URL,带上 request cookie。
|
|
280
|
-
* 给客户端截图(snapdom)库做跨域兜底用。仅 dev。
|
|
281
|
-
*/
|
|
282
|
-
interface SnapDomMiddlewareOptions {
|
|
283
|
-
proxyUrl?: string;
|
|
284
|
-
baseUrl?: string;
|
|
285
|
-
}
|
|
286
|
-
declare function registerSnapDomProxyMiddleware(middlewares: Connect.Server, options?: SnapDomMiddlewareOptions): void;
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* miaoda-coding vite-react (jsPage) 默认 Vite 配置。
|
|
290
|
-
*
|
|
291
|
-
* 通过环境变量自动读取部署相关参数,用户只需提供项目特有的覆盖:
|
|
292
|
-
*
|
|
293
|
-
* ```ts
|
|
294
|
-
* import { defineConfig } from '@lark-apaas/coding-preset-vite-react';
|
|
295
|
-
* import path from 'node:path';
|
|
296
|
-
*
|
|
297
|
-
* export default defineConfig({
|
|
298
|
-
* resolve: {
|
|
299
|
-
* alias: {
|
|
300
|
-
* '@': path.resolve(__dirname, 'src'),
|
|
301
|
-
* '@shared': path.resolve(__dirname, 'shared'),
|
|
302
|
-
* },
|
|
303
|
-
* },
|
|
304
|
-
* });
|
|
305
|
-
* ```
|
|
306
|
-
*
|
|
307
|
-
* 支持环境变量:
|
|
308
|
-
* - NODE_ENV development | production(默认 development)
|
|
309
|
-
* - CLIENT_BASE_PATH 部署侧 client base path(如 `/app/<id>`)
|
|
310
|
-
* - ASSETS_CDN_PATH 生产 JS/CSS CDN 前缀(可选)
|
|
311
|
-
* - CLIENT_DEV_PORT dev server 端口(默认 8080)
|
|
312
|
-
* - CLIENT_DEV_HOST dev server host(默认 localhost)
|
|
313
|
-
* - FORCE_FRAMEWORK_DOMAIN_MAIN 反向代理域名(启用 wss HMR + 设置 ACAO)
|
|
314
|
-
* - DISABLE_INSPECTOR `true` 关 inspector
|
|
315
|
-
* - MIAODA_FONTS_MIRROR_OFF `1` 关 Google Fonts 代理替换
|
|
316
|
-
* - MIAODA_APP_TYPE 妙搭应用类型(数字字符串,供 lite Safety 徽标判断)
|
|
317
|
-
*/
|
|
318
|
-
declare function defineConfig(overrides?: UserConfig): UserConfig;
|
|
319
|
-
|
|
320
|
-
export { capabilitiesBundlePlugin, defineConfig as default, defineConfig, devLogsPlugin, errorOverlayPlugin, fontsMirrorPlugin, healthMiddlewarePlugin, hmrTimingPlugin, htmlMinifyPlugin, minifyHtmlWithHbsProtection, moduleAliasPlugin, normalizeBasePath, ogMetaPlugin, parseRoutes, polyfillPlugin, registerSnapDomProxyMiddleware, routesPlugin, slardarPlugin, staticAssetsPlugin, viewContextPlugin, viteClientPatchPlugin, wsWatchdogPlugin };
|