@nasti-toolchain/nasti 2.3.1 → 2.4.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/README.md +64 -1
- package/bin/nasti.js +0 -0
- package/client/hmr.ts +4 -3
- package/dist/cli.cjs +957 -269
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +951 -264
- package/dist/cli.js.map +1 -1
- package/dist/client/hmr.cjs.map +1 -1
- package/dist/client/hmr.d.cts +4 -3
- package/dist/client/hmr.d.ts +4 -3
- package/dist/index.cjs +1054 -366
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -8
- package/dist/index.d.ts +64 -8
- package/dist/index.js +1048 -361
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -105,6 +105,11 @@ interface EnvironmentOptions {
|
|
|
105
105
|
* Electron renderer 会把 `electron.renderer` 映射到这里。
|
|
106
106
|
*/
|
|
107
107
|
html?: string;
|
|
108
|
+
/**
|
|
109
|
+
* 是否参与生产构建。默认 true;设为 false 可跳过默认 client,构建纯多环境应用。
|
|
110
|
+
* 仅影响 `nasti build`,不影响 dev server 中环境实例的可见性。
|
|
111
|
+
*/
|
|
112
|
+
buildEnabled?: boolean;
|
|
108
113
|
/**
|
|
109
114
|
* 外部环境编译驱动标识。声明后由插件的 `createEnvironmentDriver` 提供实际实现,
|
|
110
115
|
* 可用于接入 Rspeedy 等不基于 Rolldown 的构建系统。
|
|
@@ -118,6 +123,8 @@ interface EnvironmentOptions {
|
|
|
118
123
|
/** 解析后的环境配置 */
|
|
119
124
|
interface ResolvedEnvironmentOptions {
|
|
120
125
|
consumer: 'client' | 'server';
|
|
126
|
+
/** 是否参与生产构建 */
|
|
127
|
+
buildEnabled: boolean;
|
|
121
128
|
/** 环境构建入口(绝对路径);client 未显式配置时为空并从 HTML 提取 */
|
|
122
129
|
entry: string[];
|
|
123
130
|
/** HTML 入口绝对路径(仅 client consumer 有值) */
|
|
@@ -302,7 +309,7 @@ interface NastiPlugin {
|
|
|
302
309
|
* 所有环境构建完成后的 app 级收尾钩子,用于跨环境聚合产物。
|
|
303
310
|
* Vue Lynx 原生后端可在这里组合 background/main-thread bundle。
|
|
304
311
|
*/
|
|
305
|
-
afterBuildApp?: (results: Record<string, EnvironmentBuildResult>, api: PluginApi) => void | Promise<void>;
|
|
312
|
+
afterBuildApp?: (results: Record<string, EnvironmentBuildResult>, api: PluginApi, context: BuildAppContext) => void | Promise<void>;
|
|
306
313
|
configureServer?: (server: DevServer) => void | (() => void) | Promise<void | (() => void)>;
|
|
307
314
|
transformIndexHtml?: (html: string) => string | HtmlTagDescriptor[] | {
|
|
308
315
|
html: string;
|
|
@@ -337,14 +344,37 @@ interface EnvironmentBuildOutput {
|
|
|
337
344
|
code?: string;
|
|
338
345
|
source?: Uint8Array | string;
|
|
339
346
|
}
|
|
340
|
-
/**
|
|
341
|
-
interface
|
|
342
|
-
output: EnvironmentBuildOutput[];
|
|
347
|
+
/** 单个环境附加到标准构建结果上的结构化元数据。 */
|
|
348
|
+
interface EnvironmentBuildMetadata {
|
|
343
349
|
entries?: Record<string, string>;
|
|
344
350
|
publicPath?: string;
|
|
345
351
|
manifest?: unknown;
|
|
346
352
|
stats?: unknown;
|
|
347
353
|
}
|
|
354
|
+
/** 外部环境驱动或原生 Rolldown 环境返回的标准构建结果。 */
|
|
355
|
+
interface EnvironmentBuildResult extends EnvironmentBuildMetadata {
|
|
356
|
+
output: EnvironmentBuildOutput[];
|
|
357
|
+
}
|
|
358
|
+
/** app 级 finalizer 写出的聚合产物。 */
|
|
359
|
+
interface AppBuildOutput extends EnvironmentBuildOutput {
|
|
360
|
+
type: 'asset';
|
|
361
|
+
source: Uint8Array | string;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* 所有环境完成后提供给 `afterBuildApp` 的只读查询与产物写出接口。
|
|
365
|
+
* Lynx 等多运行时工具链可用它聚合 background/main-thread 结果,而无需读取磁盘目录。
|
|
366
|
+
*/
|
|
367
|
+
interface BuildAppContext {
|
|
368
|
+
readonly config: ResolvedConfig;
|
|
369
|
+
readonly results: Readonly<Record<string, EnvironmentBuildResult>>;
|
|
370
|
+
readonly output: readonly AppBuildOutput[];
|
|
371
|
+
getResult: (environmentName: string) => EnvironmentBuildResult | undefined;
|
|
372
|
+
getArtifact: (environmentName: string, fileName: string) => EnvironmentBuildOutput | undefined;
|
|
373
|
+
getEntry: (environmentName: string, entryName: string) => EnvironmentBuildOutput | undefined;
|
|
374
|
+
getManifest: <T = unknown>(environmentName: string) => T | undefined;
|
|
375
|
+
/** 将聚合产物安全地写入 top-level `build.outDir`,并纳入 BuildResult.appOutput。 */
|
|
376
|
+
emitFile: (file: AppBuildOutput) => string;
|
|
377
|
+
}
|
|
348
378
|
/** 外部环境驱动返回的开发服务信息。 */
|
|
349
379
|
interface EnvironmentServeResult {
|
|
350
380
|
localUrls?: string[];
|
|
@@ -380,6 +410,8 @@ interface EnvironmentInstance {
|
|
|
380
410
|
hot: HotChannel;
|
|
381
411
|
/** 声明 driver 后,由插件提供的外部环境编译驱动 */
|
|
382
412
|
driver?: EnvironmentDriver;
|
|
413
|
+
/** 由生产插件登记 entries / manifest / stats,构建完成后合并进环境结果。 */
|
|
414
|
+
setBuildMetadata: (metadata: EnvironmentBuildMetadata) => void;
|
|
383
415
|
}
|
|
384
416
|
/**
|
|
385
417
|
* renderChunk / augmentChunkHash 的 `this`:Rolldown 真实插件上下文的最小可用面。
|
|
@@ -389,6 +421,8 @@ interface EnvironmentInstance {
|
|
|
389
421
|
interface RenderChunkContext {
|
|
390
422
|
emitFile: (file: EmittedFile) => string;
|
|
391
423
|
getFileName: (referenceId: string) => string;
|
|
424
|
+
/** 当前生产钩子所属环境;BG/MT 同为 client consumer 时也可准确区分。 */
|
|
425
|
+
environment: EnvironmentInstance;
|
|
392
426
|
}
|
|
393
427
|
interface ResolveIdOptions {
|
|
394
428
|
isEntry?: boolean;
|
|
@@ -436,6 +470,8 @@ interface ModuleNode {
|
|
|
436
470
|
acceptedHmrDeps: Set<ModuleNode>;
|
|
437
471
|
transformResult: TransformResult | null;
|
|
438
472
|
lastHMRTimestamp: number;
|
|
473
|
+
/** 每次失效递增,防止较慢的旧转换覆盖较新的缓存。 */
|
|
474
|
+
invalidationVersion: number;
|
|
439
475
|
isSelfAccepting: boolean;
|
|
440
476
|
/** Environment API:节点所属环境名(per-env 模块图,默认 'client') */
|
|
441
477
|
environment?: string;
|
|
@@ -496,7 +532,12 @@ interface ModuleGraph$1 {
|
|
|
496
532
|
getModuleById: (id: string) => ModuleNode | undefined;
|
|
497
533
|
getModulesByFile: (file: string) => Set<ModuleNode> | undefined;
|
|
498
534
|
ensureEntryFromUrl: (url: string) => Promise<ModuleNode>;
|
|
499
|
-
invalidateModule: (mod: ModuleNode) => void;
|
|
535
|
+
invalidateModule: (mod: ModuleNode, timestamp?: number) => void;
|
|
536
|
+
invalidateModuleAndImporters: (mod: ModuleNode, timestamp?: number) => void;
|
|
537
|
+
getHmrBoundaries: (mod: ModuleNode) => Array<{
|
|
538
|
+
boundary: ModuleNode;
|
|
539
|
+
acceptedVia: ModuleNode;
|
|
540
|
+
}>;
|
|
500
541
|
invalidateAll: () => void;
|
|
501
542
|
}
|
|
502
543
|
interface WebSocketServer {
|
|
@@ -630,8 +671,18 @@ declare class ModuleGraph {
|
|
|
630
671
|
setModuleId(mod: ModuleNode, id: string): void;
|
|
631
672
|
/** 更新模块依赖关系 */
|
|
632
673
|
updateModuleImports(mod: ModuleNode, importedIds: Set<string>): void;
|
|
674
|
+
/**
|
|
675
|
+
* 用一次转换得到的信息原子更新 import 与 HMR accept 关系。
|
|
676
|
+
* 依赖节点会在真正被浏览器请求前预先创建,这样入口模块先转换时也能建立完整图。
|
|
677
|
+
*/
|
|
678
|
+
updateModuleInfo(mod: ModuleNode, importedUrls: Set<string>, acceptedUrls: Set<string>, isSelfAccepting: boolean, expectedInvalidationVersion?: number): Promise<Set<ModuleNode> | null>;
|
|
633
679
|
/** 使模块的转换缓存失效 */
|
|
634
|
-
invalidateModule(mod: ModuleNode): void;
|
|
680
|
+
invalidateModule(mod: ModuleNode, timestamp?: number): void;
|
|
681
|
+
/**
|
|
682
|
+
* 仅失效到 HMR 边界:显式接受依赖的模块本身不会重执行;自接受模块需要失效,
|
|
683
|
+
* 但不再继续影响其 importer。这样既能传播依赖时间戳,也不会隐式重复副作用。
|
|
684
|
+
*/
|
|
685
|
+
invalidateModuleAndImporters(mod: ModuleNode, timestamp?: number, seen?: Set<ModuleNode>): void;
|
|
635
686
|
/** 使所有模块缓存失效 */
|
|
636
687
|
invalidateAll(): void;
|
|
637
688
|
/** 获取 HMR 传播边界 - 从变更模块向上遍历找到接受更新的边界 */
|
|
@@ -665,11 +716,14 @@ declare class NastiEnvironment implements EnvironmentInstance {
|
|
|
665
716
|
moduleGraph: ModuleGraph;
|
|
666
717
|
private candidatePlugins;
|
|
667
718
|
private pluginApi;
|
|
719
|
+
private buildMetadata;
|
|
668
720
|
private initialized;
|
|
669
721
|
constructor(name: string, config: ResolvedConfig, init?: NastiEnvironmentInit);
|
|
670
722
|
/** 过滤插件并建 per-env PluginContainer */
|
|
671
723
|
init(): Promise<void>;
|
|
672
724
|
getDriverContext(): EnvironmentDriverContext;
|
|
725
|
+
setBuildMetadata(metadata: EnvironmentBuildMetadata): void;
|
|
726
|
+
getBuildMetadata(): EnvironmentBuildMetadata;
|
|
673
727
|
close(): Promise<void>;
|
|
674
728
|
}
|
|
675
729
|
/** 按 applyToEnvironment 过滤环境插件(未声明 = 应用于所有环境) */
|
|
@@ -680,8 +734,10 @@ interface BuildResult {
|
|
|
680
734
|
output: EnvironmentBuildOutput[];
|
|
681
735
|
/** 全部已构建环境的产物(2.0 多环境 builder) */
|
|
682
736
|
environments?: Record<string, BuildResult['output']>;
|
|
683
|
-
/**
|
|
737
|
+
/** 全部环境的完整结果(entries / manifest / stats 等) */
|
|
684
738
|
environmentResults?: Record<string, EnvironmentBuildResult>;
|
|
739
|
+
/** app 级 finalizer 聚合写出的产物(如 `.lynx.bundle`) */
|
|
740
|
+
appOutput?: AppBuildOutput[];
|
|
685
741
|
}
|
|
686
742
|
declare function build(inlineConfig?: NastiConfig): Promise<BuildResult>;
|
|
687
743
|
|
|
@@ -788,4 +844,4 @@ declare function buildEnvDefine(env: EnvRecord, mode: string, overrides?: Record
|
|
|
788
844
|
/** 按环境 consumer 派生 import.meta.env.SSR 的 define 覆盖 */
|
|
789
845
|
declare function ssrDefineOverrides(consumer: 'client' | 'server'): Record<string, string>;
|
|
790
846
|
|
|
791
|
-
export { type BuildConfig, type DevServer, type ElectronConfig, type EnvironmentBuildOutput, type EnvironmentBuildResult, type EnvironmentDriver, type EnvironmentDriverContext, type EnvironmentDriverServeContext, type EnvironmentInstance, type EnvironmentOptions, type EnvironmentServeResult, 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 PluginApi, type PluginApiKey, type PluginContext, type RenderChunkContext, type ResolvedConfig, type ResolvedEnvironmentOptions, type TransformResult, build, buildElectron, buildEnvDefine, createDebugger, createElectronRendererConfig, createLogger, createNoopHotChannel, createServer, createWsHotChannel, defineConfig, detectFramework, electronPlugin, electronRendererDevPath, loadEnv, monacoEditorPlugin, printServerUrls, resolveConfig, resolveEnvironmentPlugins, ssrDefineOverrides, startElectronDev };
|
|
847
|
+
export { type AppBuildOutput, type BuildAppContext, type BuildConfig, type BuildResult, type DevServer, type ElectronConfig, type EnvironmentBuildMetadata, type EnvironmentBuildOutput, type EnvironmentBuildResult, type EnvironmentDriver, type EnvironmentDriverContext, type EnvironmentDriverServeContext, type EnvironmentInstance, type EnvironmentOptions, type EnvironmentServeResult, 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 PluginApi, type PluginApiKey, type PluginContext, type RenderChunkContext, type ResolvedConfig, type ResolvedEnvironmentOptions, type TransformResult, build, buildElectron, buildEnvDefine, createDebugger, createElectronRendererConfig, createLogger, createNoopHotChannel, createServer, createWsHotChannel, defineConfig, detectFramework, electronPlugin, electronRendererDevPath, loadEnv, monacoEditorPlugin, printServerUrls, resolveConfig, resolveEnvironmentPlugins, ssrDefineOverrides, startElectronDev };
|
package/dist/index.d.ts
CHANGED
|
@@ -105,6 +105,11 @@ interface EnvironmentOptions {
|
|
|
105
105
|
* Electron renderer 会把 `electron.renderer` 映射到这里。
|
|
106
106
|
*/
|
|
107
107
|
html?: string;
|
|
108
|
+
/**
|
|
109
|
+
* 是否参与生产构建。默认 true;设为 false 可跳过默认 client,构建纯多环境应用。
|
|
110
|
+
* 仅影响 `nasti build`,不影响 dev server 中环境实例的可见性。
|
|
111
|
+
*/
|
|
112
|
+
buildEnabled?: boolean;
|
|
108
113
|
/**
|
|
109
114
|
* 外部环境编译驱动标识。声明后由插件的 `createEnvironmentDriver` 提供实际实现,
|
|
110
115
|
* 可用于接入 Rspeedy 等不基于 Rolldown 的构建系统。
|
|
@@ -118,6 +123,8 @@ interface EnvironmentOptions {
|
|
|
118
123
|
/** 解析后的环境配置 */
|
|
119
124
|
interface ResolvedEnvironmentOptions {
|
|
120
125
|
consumer: 'client' | 'server';
|
|
126
|
+
/** 是否参与生产构建 */
|
|
127
|
+
buildEnabled: boolean;
|
|
121
128
|
/** 环境构建入口(绝对路径);client 未显式配置时为空并从 HTML 提取 */
|
|
122
129
|
entry: string[];
|
|
123
130
|
/** HTML 入口绝对路径(仅 client consumer 有值) */
|
|
@@ -302,7 +309,7 @@ interface NastiPlugin {
|
|
|
302
309
|
* 所有环境构建完成后的 app 级收尾钩子,用于跨环境聚合产物。
|
|
303
310
|
* Vue Lynx 原生后端可在这里组合 background/main-thread bundle。
|
|
304
311
|
*/
|
|
305
|
-
afterBuildApp?: (results: Record<string, EnvironmentBuildResult>, api: PluginApi) => void | Promise<void>;
|
|
312
|
+
afterBuildApp?: (results: Record<string, EnvironmentBuildResult>, api: PluginApi, context: BuildAppContext) => void | Promise<void>;
|
|
306
313
|
configureServer?: (server: DevServer) => void | (() => void) | Promise<void | (() => void)>;
|
|
307
314
|
transformIndexHtml?: (html: string) => string | HtmlTagDescriptor[] | {
|
|
308
315
|
html: string;
|
|
@@ -337,14 +344,37 @@ interface EnvironmentBuildOutput {
|
|
|
337
344
|
code?: string;
|
|
338
345
|
source?: Uint8Array | string;
|
|
339
346
|
}
|
|
340
|
-
/**
|
|
341
|
-
interface
|
|
342
|
-
output: EnvironmentBuildOutput[];
|
|
347
|
+
/** 单个环境附加到标准构建结果上的结构化元数据。 */
|
|
348
|
+
interface EnvironmentBuildMetadata {
|
|
343
349
|
entries?: Record<string, string>;
|
|
344
350
|
publicPath?: string;
|
|
345
351
|
manifest?: unknown;
|
|
346
352
|
stats?: unknown;
|
|
347
353
|
}
|
|
354
|
+
/** 外部环境驱动或原生 Rolldown 环境返回的标准构建结果。 */
|
|
355
|
+
interface EnvironmentBuildResult extends EnvironmentBuildMetadata {
|
|
356
|
+
output: EnvironmentBuildOutput[];
|
|
357
|
+
}
|
|
358
|
+
/** app 级 finalizer 写出的聚合产物。 */
|
|
359
|
+
interface AppBuildOutput extends EnvironmentBuildOutput {
|
|
360
|
+
type: 'asset';
|
|
361
|
+
source: Uint8Array | string;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* 所有环境完成后提供给 `afterBuildApp` 的只读查询与产物写出接口。
|
|
365
|
+
* Lynx 等多运行时工具链可用它聚合 background/main-thread 结果,而无需读取磁盘目录。
|
|
366
|
+
*/
|
|
367
|
+
interface BuildAppContext {
|
|
368
|
+
readonly config: ResolvedConfig;
|
|
369
|
+
readonly results: Readonly<Record<string, EnvironmentBuildResult>>;
|
|
370
|
+
readonly output: readonly AppBuildOutput[];
|
|
371
|
+
getResult: (environmentName: string) => EnvironmentBuildResult | undefined;
|
|
372
|
+
getArtifact: (environmentName: string, fileName: string) => EnvironmentBuildOutput | undefined;
|
|
373
|
+
getEntry: (environmentName: string, entryName: string) => EnvironmentBuildOutput | undefined;
|
|
374
|
+
getManifest: <T = unknown>(environmentName: string) => T | undefined;
|
|
375
|
+
/** 将聚合产物安全地写入 top-level `build.outDir`,并纳入 BuildResult.appOutput。 */
|
|
376
|
+
emitFile: (file: AppBuildOutput) => string;
|
|
377
|
+
}
|
|
348
378
|
/** 外部环境驱动返回的开发服务信息。 */
|
|
349
379
|
interface EnvironmentServeResult {
|
|
350
380
|
localUrls?: string[];
|
|
@@ -380,6 +410,8 @@ interface EnvironmentInstance {
|
|
|
380
410
|
hot: HotChannel;
|
|
381
411
|
/** 声明 driver 后,由插件提供的外部环境编译驱动 */
|
|
382
412
|
driver?: EnvironmentDriver;
|
|
413
|
+
/** 由生产插件登记 entries / manifest / stats,构建完成后合并进环境结果。 */
|
|
414
|
+
setBuildMetadata: (metadata: EnvironmentBuildMetadata) => void;
|
|
383
415
|
}
|
|
384
416
|
/**
|
|
385
417
|
* renderChunk / augmentChunkHash 的 `this`:Rolldown 真实插件上下文的最小可用面。
|
|
@@ -389,6 +421,8 @@ interface EnvironmentInstance {
|
|
|
389
421
|
interface RenderChunkContext {
|
|
390
422
|
emitFile: (file: EmittedFile) => string;
|
|
391
423
|
getFileName: (referenceId: string) => string;
|
|
424
|
+
/** 当前生产钩子所属环境;BG/MT 同为 client consumer 时也可准确区分。 */
|
|
425
|
+
environment: EnvironmentInstance;
|
|
392
426
|
}
|
|
393
427
|
interface ResolveIdOptions {
|
|
394
428
|
isEntry?: boolean;
|
|
@@ -436,6 +470,8 @@ interface ModuleNode {
|
|
|
436
470
|
acceptedHmrDeps: Set<ModuleNode>;
|
|
437
471
|
transformResult: TransformResult | null;
|
|
438
472
|
lastHMRTimestamp: number;
|
|
473
|
+
/** 每次失效递增,防止较慢的旧转换覆盖较新的缓存。 */
|
|
474
|
+
invalidationVersion: number;
|
|
439
475
|
isSelfAccepting: boolean;
|
|
440
476
|
/** Environment API:节点所属环境名(per-env 模块图,默认 'client') */
|
|
441
477
|
environment?: string;
|
|
@@ -496,7 +532,12 @@ interface ModuleGraph$1 {
|
|
|
496
532
|
getModuleById: (id: string) => ModuleNode | undefined;
|
|
497
533
|
getModulesByFile: (file: string) => Set<ModuleNode> | undefined;
|
|
498
534
|
ensureEntryFromUrl: (url: string) => Promise<ModuleNode>;
|
|
499
|
-
invalidateModule: (mod: ModuleNode) => void;
|
|
535
|
+
invalidateModule: (mod: ModuleNode, timestamp?: number) => void;
|
|
536
|
+
invalidateModuleAndImporters: (mod: ModuleNode, timestamp?: number) => void;
|
|
537
|
+
getHmrBoundaries: (mod: ModuleNode) => Array<{
|
|
538
|
+
boundary: ModuleNode;
|
|
539
|
+
acceptedVia: ModuleNode;
|
|
540
|
+
}>;
|
|
500
541
|
invalidateAll: () => void;
|
|
501
542
|
}
|
|
502
543
|
interface WebSocketServer {
|
|
@@ -630,8 +671,18 @@ declare class ModuleGraph {
|
|
|
630
671
|
setModuleId(mod: ModuleNode, id: string): void;
|
|
631
672
|
/** 更新模块依赖关系 */
|
|
632
673
|
updateModuleImports(mod: ModuleNode, importedIds: Set<string>): void;
|
|
674
|
+
/**
|
|
675
|
+
* 用一次转换得到的信息原子更新 import 与 HMR accept 关系。
|
|
676
|
+
* 依赖节点会在真正被浏览器请求前预先创建,这样入口模块先转换时也能建立完整图。
|
|
677
|
+
*/
|
|
678
|
+
updateModuleInfo(mod: ModuleNode, importedUrls: Set<string>, acceptedUrls: Set<string>, isSelfAccepting: boolean, expectedInvalidationVersion?: number): Promise<Set<ModuleNode> | null>;
|
|
633
679
|
/** 使模块的转换缓存失效 */
|
|
634
|
-
invalidateModule(mod: ModuleNode): void;
|
|
680
|
+
invalidateModule(mod: ModuleNode, timestamp?: number): void;
|
|
681
|
+
/**
|
|
682
|
+
* 仅失效到 HMR 边界:显式接受依赖的模块本身不会重执行;自接受模块需要失效,
|
|
683
|
+
* 但不再继续影响其 importer。这样既能传播依赖时间戳,也不会隐式重复副作用。
|
|
684
|
+
*/
|
|
685
|
+
invalidateModuleAndImporters(mod: ModuleNode, timestamp?: number, seen?: Set<ModuleNode>): void;
|
|
635
686
|
/** 使所有模块缓存失效 */
|
|
636
687
|
invalidateAll(): void;
|
|
637
688
|
/** 获取 HMR 传播边界 - 从变更模块向上遍历找到接受更新的边界 */
|
|
@@ -665,11 +716,14 @@ declare class NastiEnvironment implements EnvironmentInstance {
|
|
|
665
716
|
moduleGraph: ModuleGraph;
|
|
666
717
|
private candidatePlugins;
|
|
667
718
|
private pluginApi;
|
|
719
|
+
private buildMetadata;
|
|
668
720
|
private initialized;
|
|
669
721
|
constructor(name: string, config: ResolvedConfig, init?: NastiEnvironmentInit);
|
|
670
722
|
/** 过滤插件并建 per-env PluginContainer */
|
|
671
723
|
init(): Promise<void>;
|
|
672
724
|
getDriverContext(): EnvironmentDriverContext;
|
|
725
|
+
setBuildMetadata(metadata: EnvironmentBuildMetadata): void;
|
|
726
|
+
getBuildMetadata(): EnvironmentBuildMetadata;
|
|
673
727
|
close(): Promise<void>;
|
|
674
728
|
}
|
|
675
729
|
/** 按 applyToEnvironment 过滤环境插件(未声明 = 应用于所有环境) */
|
|
@@ -680,8 +734,10 @@ interface BuildResult {
|
|
|
680
734
|
output: EnvironmentBuildOutput[];
|
|
681
735
|
/** 全部已构建环境的产物(2.0 多环境 builder) */
|
|
682
736
|
environments?: Record<string, BuildResult['output']>;
|
|
683
|
-
/**
|
|
737
|
+
/** 全部环境的完整结果(entries / manifest / stats 等) */
|
|
684
738
|
environmentResults?: Record<string, EnvironmentBuildResult>;
|
|
739
|
+
/** app 级 finalizer 聚合写出的产物(如 `.lynx.bundle`) */
|
|
740
|
+
appOutput?: AppBuildOutput[];
|
|
685
741
|
}
|
|
686
742
|
declare function build(inlineConfig?: NastiConfig): Promise<BuildResult>;
|
|
687
743
|
|
|
@@ -788,4 +844,4 @@ declare function buildEnvDefine(env: EnvRecord, mode: string, overrides?: Record
|
|
|
788
844
|
/** 按环境 consumer 派生 import.meta.env.SSR 的 define 覆盖 */
|
|
789
845
|
declare function ssrDefineOverrides(consumer: 'client' | 'server'): Record<string, string>;
|
|
790
846
|
|
|
791
|
-
export { type BuildConfig, type DevServer, type ElectronConfig, type EnvironmentBuildOutput, type EnvironmentBuildResult, type EnvironmentDriver, type EnvironmentDriverContext, type EnvironmentDriverServeContext, type EnvironmentInstance, type EnvironmentOptions, type EnvironmentServeResult, 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 PluginApi, type PluginApiKey, type PluginContext, type RenderChunkContext, type ResolvedConfig, type ResolvedEnvironmentOptions, type TransformResult, build, buildElectron, buildEnvDefine, createDebugger, createElectronRendererConfig, createLogger, createNoopHotChannel, createServer, createWsHotChannel, defineConfig, detectFramework, electronPlugin, electronRendererDevPath, loadEnv, monacoEditorPlugin, printServerUrls, resolveConfig, resolveEnvironmentPlugins, ssrDefineOverrides, startElectronDev };
|
|
847
|
+
export { type AppBuildOutput, type BuildAppContext, type BuildConfig, type BuildResult, type DevServer, type ElectronConfig, type EnvironmentBuildMetadata, type EnvironmentBuildOutput, type EnvironmentBuildResult, type EnvironmentDriver, type EnvironmentDriverContext, type EnvironmentDriverServeContext, type EnvironmentInstance, type EnvironmentOptions, type EnvironmentServeResult, 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 PluginApi, type PluginApiKey, type PluginContext, type RenderChunkContext, type ResolvedConfig, type ResolvedEnvironmentOptions, type TransformResult, build, buildElectron, buildEnvDefine, createDebugger, createElectronRendererConfig, createLogger, createNoopHotChannel, createServer, createWsHotChannel, defineConfig, detectFramework, electronPlugin, electronRendererDevPath, loadEnv, monacoEditorPlugin, printServerUrls, resolveConfig, resolveEnvironmentPlugins, ssrDefineOverrides, startElectronDev };
|