@nasti-toolchain/nasti 1.7.1 → 2.0.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/dist/index.d.cts CHANGED
@@ -1,4 +1,40 @@
1
- import { InputOptions, OutputOptions } from 'rolldown';
1
+ import { InputOptions, OutputOptions, RenderedChunk } from 'rolldown';
2
+
3
+ type LogType = 'error' | 'warn' | 'info';
4
+ type LogLevel = LogType | 'silent';
5
+ interface LogOptions {
6
+ /** 是否清屏(仅 allowClearScreen 且 TTY 下生效) */
7
+ clear?: boolean;
8
+ /** 是否带 HH:mm:ss 时间戳前缀 */
9
+ timestamp?: boolean;
10
+ /** 关联的 Error(用于 hasErrorLogged 去重) */
11
+ error?: Error | null;
12
+ }
13
+ interface Logger {
14
+ info(msg: string, options?: LogOptions): void;
15
+ warn(msg: string, options?: LogOptions): void;
16
+ /** 同一条 warn 整个进程只输出一次 */
17
+ warnOnce(msg: string, options?: LogOptions): void;
18
+ error(msg: string, options?: LogOptions): void;
19
+ clearScreen(type: LogType): void;
20
+ /** 该 Error 是否已经走 logger.error 输出过(避免 CLI 兜底重复打印) */
21
+ hasErrorLogged(error: Error): boolean;
22
+ hasWarned: boolean;
23
+ }
24
+ interface LoggerOptions {
25
+ prefix?: string;
26
+ allowClearScreen?: boolean;
27
+ customLogger?: Logger;
28
+ console?: Console;
29
+ }
30
+ declare const LogLevels: Record<LogLevel, number>;
31
+ declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
32
+ interface ServerUrls {
33
+ local: string[];
34
+ network: string[];
35
+ }
36
+ /** 打印 dev server 地址:➜ Local / Network,端口加粗 */
37
+ declare function printServerUrls(urls: ServerUrls, info: Logger['info']): void;
2
38
 
3
39
  interface NastiConfig {
4
40
  /** 项目根目录 */
@@ -25,6 +61,56 @@ interface NastiConfig {
25
61
  envPrefix?: string | string[];
26
62
  /** 日志级别 */
27
63
  logLevel?: 'info' | 'warn' | 'error' | 'silent';
64
+ /** 启动/重启时是否允许清屏(CI/非 TTY 下自动禁用),默认 true */
65
+ clearScreen?: boolean;
66
+ /** 自定义 Logger(替换内置实现,logLevel 等选项由自定义实现自行处理) */
67
+ customLogger?: Logger;
68
+ /**
69
+ * 环境配置 map(Environment API,2.0)。默认注入 `{ client, ssr }`。
70
+ *
71
+ * `client` 环境与 top-level `resolve`/`build` **精确镜像**:对
72
+ * `environments.client` 的覆盖会写回 top-level(反之亦然),保证读 flat
73
+ * config 的既有插件与新 API 看到同一份配置。
74
+ */
75
+ environments?: Record<string, EnvironmentOptions>;
76
+ /** 实验特性(无稳定性保证,随时可能变更/移除) */
77
+ experimental?: ExperimentalOptions;
78
+ }
79
+ interface ExperimentalOptions {
80
+ /**
81
+ * dev 用 Rolldown `dev()` 引擎整体打包 client 环境后从内存服务
82
+ * (完整打包模式 / Full Bundle Mode)。HMR 由引擎的 patch 机制驱动,
83
+ * 动态 import 走懒编译端点。依赖 rolldown 实验 API(无 semver 保护,
84
+ * 版本锁定 rc.13)。unbundled 管线保持默认。
85
+ * @experimental
86
+ * @default false
87
+ */
88
+ bundledDev?: boolean;
89
+ }
90
+ /** 单个环境的可配置面(Environment API) */
91
+ interface EnvironmentOptions {
92
+ /**
93
+ * 产物消费者:决定 per-env 的 resolve 行为与 `import.meta.env.SSR` 取值。
94
+ * 默认:环境名为 'client' → 'client',其余 → 'server'。
95
+ */
96
+ consumer?: 'client' | 'server';
97
+ /**
98
+ * 该环境的构建入口(相对 root)。client 环境忽略此项(入口从 index.html
99
+ * 提取);非 client 环境**只有声明了 entry 才会被 `nasti build` 构建**。
100
+ */
101
+ entry?: string | string[];
102
+ /** per-env 路径解析(client 默认含 'browser' condition;server 走 node conditions) */
103
+ resolve?: ResolveConfig;
104
+ /** per-env 构建覆盖(未设置的字段回退 top-level build) */
105
+ build?: BuildConfig;
106
+ }
107
+ /** 解析后的环境配置 */
108
+ interface ResolvedEnvironmentOptions {
109
+ consumer: 'client' | 'server';
110
+ /** 非 client 环境的构建入口(绝对路径);client 恒为 [] */
111
+ entry: string[];
112
+ resolve: Required<ResolveConfig>;
113
+ build: Required<BuildConfig>;
28
114
  }
29
115
  /** Electron 目标专用配置,支持 Electron 41+ */
30
116
  interface ElectronConfig {
@@ -102,6 +188,14 @@ interface BuildConfig {
102
188
  rolldownOptions?: NastiRolldownOptions;
103
189
  emptyOutDir?: boolean;
104
190
  css?: CssConfig;
191
+ /** 体积表是否计算 gzip 压缩后大小(大产物可关闭以加速构建),默认 true */
192
+ reportCompressedSize?: boolean;
193
+ /** 触发大 chunk 警告的体积阈值(单位 kB,按压缩前 chunk 体积),默认 500 */
194
+ chunkSizeWarningLimit?: number;
195
+ /** 按 chunk 抽取 CSS 为独立 .css 文件(关闭则全部合并为单个 CSS 文件),默认 true */
196
+ cssCodeSplit?: boolean;
197
+ /** 是否压缩抽取出的 CSS(Lightning CSS,不可用时回退正则压缩),默认同 minify */
198
+ cssMinify?: boolean;
105
199
  }
106
200
  /**
107
201
  * Nasti 暴露的 Rolldown 选项:在 Rolldown {@link InputOptions} 基础上去掉由 Nasti
@@ -112,9 +206,12 @@ type NastiRolldownOptions = Omit<InputOptions, 'input' | 'plugins'> & {
112
206
  output?: OutputOptions;
113
207
  };
114
208
  interface CssConfig {
115
- /** CSP nonce to add to inline <style> tags */
209
+ /** CSP nonce to add to inline <style> tags (dev only since 2.0 — build emits real .css files) */
116
210
  nonce?: string;
117
- /** Emit CSS as separate files instead of inline injection (CSP-friendly) */
211
+ /**
212
+ * @deprecated 2.0 起 build 始终抽取真实 .css 文件(per-chunk hash + <link> 注入),
213
+ * 该开关不再生效。控制拆分用 `build.cssCodeSplit`,控制压缩用 `build.cssMinify`。
214
+ */
118
215
  emitCssFile?: boolean;
119
216
  }
120
217
  interface NastiPlugin {
@@ -135,11 +232,46 @@ interface NastiPlugin {
135
232
  resolveId?: (this: PluginContext, source: string, importer: string | undefined, options: ResolveIdOptions) => ResolveIdResult | Promise<ResolveIdResult>;
136
233
  load?: (this: PluginContext, id: string) => LoadResult | Promise<LoadResult>;
137
234
  transform?: (this: PluginContext, code: string, id: string) => TransformResult | Promise<TransformResult>;
235
+ /**
236
+ * Rolldown output 阶段钩子:对每个 chunk 的最终代码做变换或按 chunk 收集产物。
237
+ * 仅在生产构建生效(dev unbundled 管线没有 chunk 概念)。
238
+ *
239
+ * `this` 是 Rolldown 真实的(Rollup 兼容)插件上下文,不是 PluginContext stub:
240
+ * `this.emitFile({type:'asset'})` 经 `output.assetFileNames` 产出带 hash 的文件,
241
+ * `this.getFileName(ref)` 可立即解析最终文件名。CSS per-chunk 抽取依赖这两点。
242
+ */
243
+ renderChunk?: (this: RenderChunkContext, code: string, chunk: RenderedChunk) => string | {
244
+ code: string;
245
+ map?: unknown;
246
+ } | null | undefined | Promise<string | {
247
+ code: string;
248
+ map?: unknown;
249
+ } | null | undefined>;
250
+ /** 向 chunk hash 折叠额外输入(如该 chunk 关联的 CSS 内容),保证缓存正确性 */
251
+ augmentChunkHash?: (this: RenderChunkContext, chunk: RenderedChunk) => string | void | Promise<string | void>;
252
+ /**
253
+ * Rolldown output 收尾钩子(write 前最后时机)。`this` 同 renderChunk,
254
+ * 可 emitFile 补充产物(如 cssCodeSplit:false 的合并 CSS、manifest 等)。
255
+ */
256
+ generateBundle?: (this: RenderChunkContext, options?: unknown, bundle?: Record<string, unknown>) => void | Promise<void>;
138
257
  config?: (config: NastiConfig, env: {
139
258
  mode: string;
140
259
  command: string;
141
260
  }) => NastiConfig | null | void | Promise<NastiConfig | null | void>;
142
261
  configResolved?: (config: ResolvedConfig) => void | Promise<void>;
262
+ /**
263
+ * Environment API:在环境配置最终解析前调整单个环境的选项。
264
+ * 对每个环境名调用一次(含默认注入的 client/ssr)。
265
+ */
266
+ configEnvironment?: (name: string, options: EnvironmentOptions, env: {
267
+ mode: string;
268
+ command: string;
269
+ }) => EnvironmentOptions | null | void | Promise<EnvironmentOptions | null | void>;
270
+ /**
271
+ * Environment API:按环境过滤插件。返回 false 则该插件不进入此环境的
272
+ * 插件管线。未声明时插件应用于所有环境(与 Vite 默认一致)。
273
+ */
274
+ applyToEnvironment?: (environment: EnvironmentInstance) => boolean;
143
275
  configureServer?: (server: DevServer) => void | (() => void) | Promise<void | (() => void)>;
144
276
  transformIndexHtml?: (html: string) => string | HtmlTagDescriptor[] | {
145
277
  html: string;
@@ -154,6 +286,32 @@ interface PluginContext {
154
286
  resolve: (source: string, importer?: string) => Promise<ResolveIdResult>;
155
287
  emitFile: (file: EmittedFile) => string;
156
288
  getModuleInfo: (id: string) => ModuleInfo | null;
289
+ /**
290
+ * Environment API:当前钩子运行所在的环境(dev 管线中可用;
291
+ * 生产构建的 Rolldown 钩子注入在 Phase 2 接线)。
292
+ */
293
+ environment?: EnvironmentInstance;
294
+ }
295
+ /**
296
+ * 环境实例的公共面(核心实现见 core/environment.ts 的 NastiEnvironment)。
297
+ * 插件经 `this.environment` / `applyToEnvironment(env)` 感知环境。
298
+ */
299
+ interface EnvironmentInstance {
300
+ name: string;
301
+ consumer: 'client' | 'server';
302
+ mode: 'dev' | 'build';
303
+ config: ResolvedConfig;
304
+ options: ResolvedEnvironmentOptions;
305
+ hot: HotChannel;
306
+ }
307
+ /**
308
+ * renderChunk / augmentChunkHash 的 `this`:Rolldown 真实插件上下文的最小可用面。
309
+ * 与 {@link PluginContext}(dev/buildStart 用的 stub)不同,这里的 emitFile 返回
310
+ * referenceId,getFileName 能解析出带 hash 的最终文件名。
311
+ */
312
+ interface RenderChunkContext {
313
+ emitFile: (file: EmittedFile) => string;
314
+ getFileName: (referenceId: string) => string;
157
315
  }
158
316
  interface ResolveIdOptions {
159
317
  isEntry?: boolean;
@@ -171,6 +329,8 @@ type TransformResult = string | null | undefined | {
171
329
  code: string;
172
330
  map?: unknown;
173
331
  moduleType?: string;
332
+ /** 透传 Rolldown:'no-treeshake' 可保证模块不被摇出 chunk.moduleIds */
333
+ moduleSideEffects?: boolean | 'no-treeshake';
174
334
  };
175
335
  interface EmittedFile {
176
336
  type: 'asset' | 'chunk';
@@ -200,6 +360,8 @@ interface ModuleNode {
200
360
  transformResult: TransformResult | null;
201
361
  lastHMRTimestamp: number;
202
362
  isSelfAccepting: boolean;
363
+ /** Environment API:节点所属环境名(per-env 模块图,默认 'client') */
364
+ environment?: string;
203
365
  }
204
366
  interface ResolvedConfig {
205
367
  root: string;
@@ -215,18 +377,41 @@ interface ResolvedConfig {
215
377
  electron: Required<ElectronConfig>;
216
378
  envPrefix: string[];
217
379
  logLevel: 'info' | 'warn' | 'error' | 'silent';
380
+ clearScreen: boolean;
381
+ /** 已接线 logLevel 的 Logger 实例,所有 Nasti 输出统一经此通道 */
382
+ logger: Logger;
383
+ /**
384
+ * 解析后的环境 map(默认 client + ssr)。`environments.client` 的
385
+ * resolve/build 与 top-level **同引用**(精确镜像,运行时有断言校验)。
386
+ */
387
+ environments: Record<string, ResolvedEnvironmentOptions>;
388
+ experimental: Required<ExperimentalOptions>;
218
389
  }
219
390
  interface DevServer {
220
391
  config: ResolvedConfig;
221
392
  middlewares: any;
222
- moduleGraph: ModuleGraph;
393
+ /**
394
+ * client 环境模块图的别名(back-compat)。
395
+ * @deprecated 跟随 Vite 退役 flat `server.*` 的方向,2.x 移除;
396
+ * 新代码请用 `server.environments.client.moduleGraph`。
397
+ */
398
+ moduleGraph: ModuleGraph$1;
223
399
  watcher: any;
224
400
  ws: WebSocketServer;
401
+ /** Environment API:per-env 环境实例(Phase 1 仅 client 有完整运行时) */
402
+ environments: Record<string, EnvironmentInstance>;
225
403
  listen: (port?: number) => Promise<DevServer>;
226
404
  close: () => Promise<void>;
227
405
  transformRequest: (url: string) => Promise<TransformResult>;
406
+ /**
407
+ * SSR:在 server consumer 环境(默认 `ssr`)中加载并执行模块,返回其导出。
408
+ * Vite `server.ssrLoadModule` 的 back-compat shim(底层是 module runner +
409
+ * HotChannel invoke 桥)。模块经 moduleRunnerTransform 转换后在进程内求值,
410
+ * `import.meta.env.SSR === true`,bare import 外部化交给 node 解析。
411
+ */
412
+ ssrLoadModule: (url: string) => Promise<Record<string, unknown>>;
228
413
  }
229
- interface ModuleGraph {
414
+ interface ModuleGraph$1 {
230
415
  getModuleByUrl: (url: string) => ModuleNode | undefined;
231
416
  getModuleById: (id: string) => ModuleNode | undefined;
232
417
  getModulesByFile: (file: string) => Set<ModuleNode> | undefined;
@@ -238,6 +423,32 @@ interface WebSocketServer {
238
423
  send: (payload: HmrPayload) => void;
239
424
  close: () => void;
240
425
  }
426
+ type HotChannelListener = (data: unknown, client: HotChannelClient) => void;
427
+ interface HotChannelClient {
428
+ send: (payload: HmrPayload) => void;
429
+ }
430
+ /** module runner 经 invoke 调用的 RPC 方法集(Vite DevEnvironment.hot.setInvokeHandler 同构) */
431
+ interface HotChannelInvokeHandlers {
432
+ /** runner 回调 fetchModule → transformRequest → 求值 */
433
+ fetchModule: (id: string, importer?: string, options?: {
434
+ cached?: boolean;
435
+ }) => Promise<unknown>;
436
+ /** server 环境的内建模块清单(string/RegExp,序列化需对齐 runner 期望) */
437
+ getBuiltins?: () => Promise<Array<string | RegExp>> | Array<string | RegExp>;
438
+ /** 网络暴露的 transport 跳过文件系统存在性检查(安全相关,显式带上) */
439
+ _skipFsCheck?: boolean;
440
+ }
441
+ interface HotChannel {
442
+ /** 向该环境的所有客户端广播 */
443
+ send: (payload: HmrPayload) => void;
444
+ /** 监听客户端自定义事件(custom events / invoke transport) */
445
+ on?: (event: string, listener: HotChannelListener) => void;
446
+ off?: (event: string, listener: HotChannelListener) => void;
447
+ listen?: () => void;
448
+ close?: () => void | Promise<void>;
449
+ /** 注册 invoke 处理器(SSR runner 的 RPC 桥;Phase 1 仅定义契约) */
450
+ setInvokeHandler?: (handlers: HotChannelInvokeHandlers | undefined) => void;
451
+ }
241
452
  interface HmrContext {
242
453
  file: string;
243
454
  timestamp: number;
@@ -282,13 +493,106 @@ declare function defineConfig(config: NastiConfig): NastiConfig;
282
493
  */
283
494
  declare function resolveConfig(inlineConfig: NastiConfig | undefined, command: 'build' | 'serve'): Promise<ResolvedConfig>;
284
495
 
496
+ declare class PluginContainer {
497
+ private plugins;
498
+ private config;
499
+ private ctx;
500
+ private emittedFiles;
501
+ /** Environment API:容器所属环境(未传时为 undefined,行为同 1.x client) */
502
+ readonly environment?: EnvironmentInstance;
503
+ constructor(config: ResolvedConfig, environment?: EnvironmentInstance);
504
+ private createContext;
505
+ /** 返回所有通过 emitFile() 输出的文件 */
506
+ getEmittedFiles(): Array<{
507
+ fileName: string;
508
+ source: string | Uint8Array;
509
+ }>;
510
+ buildStart(): Promise<void>;
511
+ buildEnd(error?: Error): Promise<void>;
512
+ resolveId(source: string, importer?: string, options?: {
513
+ isEntry?: boolean;
514
+ }): Promise<ResolveIdResult>;
515
+ load(id: string): Promise<LoadResult>;
516
+ transform(code: string, id: string): Promise<TransformResult>;
517
+ /** 完整的模块处理管道: resolveId → load → transform */
518
+ processModule(source: string, importer?: string): Promise<{
519
+ id: string;
520
+ code: string;
521
+ } | null>;
522
+ getPlugins(): NastiPlugin[];
523
+ }
524
+
525
+ declare class ModuleGraph {
526
+ private urlToModuleMap;
527
+ private idToModuleMap;
528
+ private fileToModulesMap;
529
+ getModuleByUrl(url: string): ModuleNode | undefined;
530
+ getModuleById(id: string): ModuleNode | undefined;
531
+ getModulesByFile(file: string): Set<ModuleNode> | undefined;
532
+ ensureEntryFromUrl(url: string): Promise<ModuleNode>;
533
+ createModule(url: string, id?: string): ModuleNode;
534
+ /** 注册文件路径到模块的映射 */
535
+ registerModule(mod: ModuleNode, file: string): void;
536
+ /**
537
+ * Reindex a module under a plugin-provided canonical id (e.g. a `\0virtual:foo`
538
+ * id returned from `resolveId`). Plugins look up their own virtual modules via
539
+ * `getModuleById(RESOLVED_ID)` to invalidate them on watcher events; without
540
+ * this remap they'd never find the node because `ensureEntryFromUrl` keys by
541
+ * the public URL only.
542
+ */
543
+ setModuleId(mod: ModuleNode, id: string): void;
544
+ /** 更新模块依赖关系 */
545
+ updateModuleImports(mod: ModuleNode, importedIds: Set<string>): void;
546
+ /** 使模块的转换缓存失效 */
547
+ invalidateModule(mod: ModuleNode): void;
548
+ /** 使所有模块缓存失效 */
549
+ invalidateAll(): void;
550
+ /** 获取 HMR 传播边界 - 从变更模块向上遍历找到接受更新的边界 */
551
+ getHmrBoundaries(mod: ModuleNode): {
552
+ boundary: ModuleNode;
553
+ acceptedVia: ModuleNode;
554
+ }[];
555
+ }
556
+
557
+ interface NastiEnvironmentInit {
558
+ hot?: HotChannel;
559
+ mode?: 'dev' | 'build';
560
+ /** 环境的候选插件(init 时经 applyToEnvironment 过滤) */
561
+ plugins?: NastiPlugin[];
562
+ }
563
+ declare class NastiEnvironment implements EnvironmentInstance {
564
+ readonly name: string;
565
+ readonly consumer: 'client' | 'server';
566
+ readonly mode: 'dev' | 'build';
567
+ readonly config: ResolvedConfig;
568
+ readonly options: ResolvedEnvironmentOptions;
569
+ readonly hot: HotChannel;
570
+ /** applyToEnvironment 过滤后的插件(init() 后可用) */
571
+ plugins: NastiPlugin[];
572
+ /** per-env 插件容器(init() 后可用;dev 管线使用) */
573
+ pluginContainer: PluginContainer | null;
574
+ /** per-env 模块图(dev 管线使用) */
575
+ moduleGraph: ModuleGraph;
576
+ private candidatePlugins;
577
+ private initialized;
578
+ constructor(name: string, config: ResolvedConfig, init?: NastiEnvironmentInit);
579
+ /** 过滤插件并建 per-env PluginContainer */
580
+ init(): Promise<void>;
581
+ close(): Promise<void>;
582
+ }
583
+ /** 按 applyToEnvironment 过滤环境插件(未声明 = 应用于所有环境) */
584
+ declare function resolveEnvironmentPlugins(environment: EnvironmentInstance, plugins: NastiPlugin[]): NastiPlugin[];
585
+
285
586
  interface BuildResult {
587
+ /** client 环境的产物(back-compat:1.x 的 BuildResult 形态) */
286
588
  output: Array<{
287
589
  fileName: string;
288
590
  type: string;
289
591
  code?: string;
290
592
  source?: Uint8Array | string;
291
593
  }>;
594
+ /** 全部已构建环境的产物(2.0 多环境 builder) */
595
+ environments?: Record<string, BuildResult['output']>;
292
596
  }
293
597
  declare function build(inlineConfig?: NastiConfig): Promise<BuildResult>;
294
598
 
@@ -350,4 +654,40 @@ interface MonacoEditorPluginOptions {
350
654
  }
351
655
  declare function monacoEditorPlugin(options?: MonacoEditorPluginOptions): NastiPlugin;
352
656
 
353
- export { type BuildConfig, type DevServer, type ElectronConfig, type HmrPayload, type ModuleNode, type MonacoCustomWorker, type MonacoEditorLanguageWorker, type MonacoEditorPluginOptions, type NastiConfig, type NastiPlugin, type NastiRolldownOptions, type ResolvedConfig, type TransformResult, build, buildElectron, createServer, defineConfig, electronPlugin, monacoEditorPlugin, resolveConfig, startElectronDev };
657
+ /** client 环境的占位通道(SSR/edge Phase 2 接上真实 transport) */
658
+ declare function createNoopHotChannel(): HotChannel;
659
+ /**
660
+ * client 环境的 ws 通道:包装 server/ws.ts 的 WebSocketServer。
661
+ * 事件监听与 invoke 在现有 ws 协议上预留(custom event 协议 Phase 2 扩展)。
662
+ */
663
+ declare function createWsHotChannel(ws: WebSocketServer): HotChannel;
664
+
665
+ type NastiDebugScope = `nasti:${string}`;
666
+ interface DebuggerOptions {
667
+ /** 仅当 DEBUG 精确包含该命名空间(而非 nasti:* 通配)时才启用 */
668
+ onlyWhenFocused?: boolean | string;
669
+ }
670
+ declare function createDebugger(namespace: NastiDebugScope, options?: DebuggerOptions): ((...args: unknown[]) => void) | undefined;
671
+
672
+ interface EnvRecord {
673
+ [key: string]: string;
674
+ }
675
+ /**
676
+ * 从 .env 文件加载环境变量,按优先级合并:
677
+ * .env < .env.[mode] < .env.local < .env.[mode].local
678
+ */
679
+ declare function loadEnv(mode: string, root: string, prefixes: string[]): EnvRecord;
680
+ /**
681
+ * 将过滤后的 env 转为 Rolldown define 对象
682
+ * 例: { VITE_FOO: 'bar' } → { 'import.meta.env.VITE_FOO': '"bar"' }
683
+ * 同时注入 import.meta.env.MODE / DEV / PROD / SSR
684
+ *
685
+ * per-env define 钩子(Phase1→Phase2 接口契约):`overrides` 允许调用方按
686
+ * 环境覆盖任意 define —— server 环境传 `ssrDefineOverrides('server')` 注入
687
+ * `import.meta.env.SSR='true'`,不再写死 'false'。
688
+ */
689
+ declare function buildEnvDefine(env: EnvRecord, mode: string, overrides?: Record<string, string>): Record<string, string>;
690
+ /** 按环境 consumer 派生 import.meta.env.SSR 的 define 覆盖 */
691
+ declare function ssrDefineOverrides(consumer: 'client' | 'server'): Record<string, string>;
692
+
693
+ export { type BuildConfig, type DevServer, type ElectronConfig, type EnvironmentInstance, type EnvironmentOptions, type HmrPayload, type HotChannel, type HotChannelClient, type HotChannelInvokeHandlers, type LogLevel, LogLevels, type LogOptions, type Logger, type ModuleNode, type MonacoCustomWorker, type MonacoEditorLanguageWorker, type MonacoEditorPluginOptions, type NastiConfig, NastiEnvironment, type NastiPlugin, type NastiRolldownOptions, type PluginContext, type RenderChunkContext, type ResolvedConfig, type ResolvedEnvironmentOptions, type TransformResult, build, buildElectron, buildEnvDefine, createDebugger, createLogger, createNoopHotChannel, createServer, createWsHotChannel, defineConfig, electronPlugin, loadEnv, monacoEditorPlugin, printServerUrls, resolveConfig, resolveEnvironmentPlugins, ssrDefineOverrides, startElectronDev };