@oiyo/core 0.2.1 → 0.3.0-beta.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,14 +1,13 @@
1
1
  /**
2
- * @oiyo/core v0.2.1-beta.1
2
+ * @oiyo/core v0.3.0-beta.1
3
3
  * Copyright (c) 2026 skiyee. All rights reserved.
4
4
  * Commercial software. See LICENSE for terms.
5
5
  * Official site: https://oiyo.js.org
6
6
  */
7
- import { GlobRule, GlobalStyle, OiyoConfig, Page, PagesConfig, PagesJson } from "@oiyo/config";
8
- import * as _$vue from "vue";
9
7
  import * as _$magic_string0 from "magic-string";
8
+ import { ComponentScanTarget, GlobalStyle, OiyoConfig, PagesConfig } from "@oiyo/config";
9
+ import * as _$vue from "vue";
10
10
  import { SFCDescriptor } from "@vue/compiler-sfc";
11
- import { ConfigWatcher } from "c12";
12
11
  import { Plugin } from "vite";
13
12
 
14
13
  //#region src/logger.d.ts
@@ -44,40 +43,19 @@ interface LoggerOptions {
44
43
  declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
45
44
  //#endregion
46
45
  //#region src/module/api/types.d.ts
47
- /** 自动 API 条目,描述一个可被自动导入的模块导出项 */
48
- interface AutoApiItem {
49
- /** 导出名称,如 'default' 或具名导出 */
50
- exportName: string;
46
+ interface ApiFile {
51
47
  /** 源文件在磁盘上的绝对路径 */
52
48
  filePath: string;
53
- /** 对外暴露的导入路径(可能经过 importBase 规范化) */
54
- importPath?: string;
55
- /** 在消费端使用的本地标识符名称 */
56
- name: string;
57
- }
58
- /** 手动注册的 API 条目,由用户在配置中通过 scan.apis.only 显式声明 */
59
- interface IncludedApi {
60
- /** 源导出名称,默认与 name 相同 */
61
- export?: string;
62
- /** 模块来源路径 */
63
- from: string;
64
- /** 本地注册名称 */
65
- name: string;
66
- }
67
- /** 批量扫描 API 的源配置,描述一个目录/包的扫描规则 */
68
- interface IncludedApisSource {
69
- /** 需要排除的导出名称列表 */
70
- exclude?: string[];
71
- /** 忽略文件/目录的 glob 规则 */
72
- ignore?: GlobRule;
73
- /** 包导入基准路径(bare specifier),用于生成对外导入语句 */
74
- importBase?: string;
75
- /** 匹配文件的 glob 规则,默认匹配 TS/JS 模块文件 */
76
- pattern?: GlobRule;
77
- /** 扫描源目录/包的绝对路径 */
78
- path: string;
79
- /** 是否同时扫描并注册类型导出 */
80
- types?: boolean;
49
+ /** 导出名称,如 'default' 或具名导出 */
50
+ exportName: string;
51
+ /** 被消费的导入绝对路径 */
52
+ importPath: string;
53
+ /** 被消费的引用命名 */
54
+ importName: string;
55
+ /** 是否为类型 */
56
+ isType: boolean;
57
+ /** 是否位于 Node 模块中 */
58
+ isNodeModule: boolean;
81
59
  }
82
60
  //#endregion
83
61
  //#region src/state/index.d.ts
@@ -116,170 +94,130 @@ declare class OiyoState {
116
94
  markGenerated(): OiyoMetadata;
117
95
  }
118
96
  //#endregion
119
- //#region src/module/api/index.d.ts
120
- /**
121
- * 自动 API 管理模块
122
- *
123
- * 负责扫描指定目录/包中的模块导出,生成自动导入语句和全局类型声明。
124
- * 核心流程:
125
- * 1. 构造时注册配置中的扫描器(registerConfigScanners)
126
- * 2. collectApis() 扫描所有源文件并收集导出项
127
- * 3. resolveImports() 分析代码引用并生成 import 语句
128
- * 4. generateDeclaration() / writeDeclaration() 生成并写入全局类型声明文件
129
- */
97
+ //#region src/module/api/instance.d.ts
130
98
  declare class OiyoModApi {
131
- private readonly _config;
132
- /** 已扫描收集的值导出列表 */
133
- autoApis: AutoApiItem[];
134
- /** 已扫描收集的类型导出列表 */
135
- autoApiTypes: AutoApiItem[];
136
- /** 值导出注册表,按 name 索引,用于去重和快速查找 */
137
- private readonly autoApiMap;
138
- /** 类型导出注册表,按 name 索引 */
139
- private readonly autoApiTypeMap;
140
- /** 手动注册的值 API(来自配置中的 only 声明) */
141
- private readonly includedApis;
142
- /** 手动注册的类型 API */
143
- private readonly includedApiTypes;
144
- /** 待扫描的 API 源列表 */
145
- private readonly apiSources;
99
+ private readonly config;
146
100
  private readonly logger;
147
101
  private readonly oiyoState;
148
- constructor(_config: OiyoConfig, deps: {
102
+ /** 不含有 only 的 ApiScanTarget */
103
+ private sources;
104
+ apis: Map<string, ApiFile>;
105
+ constructor(config: OiyoConfig, deps: {
149
106
  logger: Logger;
150
107
  oiyoState: OiyoState;
151
108
  });
152
- /** oiyo 状态目录路径 */
153
- get stateDir(): string;
154
- /** 类型声明文件存放目录 */
155
- get typesDir(): string;
156
- /** API 全局类型声明文件的完整路径(apis.d.ts) */
157
- get declarationPath(): string;
158
- /** 判断给定文件路径是否属于已注册的 API 扫描源 */
159
- isAutoApiPath(absPath: string): boolean;
160
- /** 手动注册值 API 项(来自显式声明,非扫描所得) */
161
- includeApi(input: IncludedApi | IncludedApi[]): void;
162
- /** 手动注册类型 API 项 */
163
- includeApiType(input: IncludedApi | IncludedApi[]): void;
164
- /**
165
- * 批量注册 API 扫描源(自动去重)
166
- * 支持字符串路径或完整的 IncludedApisSource 配置对象
167
- */
168
- includeApis(input: string | string[] | IncludedApisSource | IncludedApisSource[]): void;
169
- /** 解析配置文件中的 scan.apis,分别注册到扫描源或手动注册列表 */
170
- private registerConfigScanners;
171
- /** 重置所有已收集的状态(在重新扫描前调用) */
172
- private resetCollectedState;
173
- /**
174
- * 注册一个值导出项,处理同名冲突检测
175
- * - 同文件同导出名:跳过(重复)
176
- * - 同文件但已有具名导出时遇到 default:跳过(具名优先)
177
- * - 不同文件同名:冲突警告并跳过
178
- * @returns 是否注册成功
179
- */
180
- private registerValue;
109
+ private get srcDir();
110
+ private get declarationDir();
111
+ private get declarationFile();
112
+ shouldSkipImport(name: string): boolean;
113
+ private recordApiSource;
114
+ private toApiSource;
115
+ private saveApi;
181
116
  /**
182
- * 注册一个类型导出项,处理同名冲突检测
183
- * 同文件同导出名视为重复跳过,不同文件同名则冲突警告
117
+ * 直接提取
118
+ * - 1.必须是 Node 包
119
+ * - 2.必须指定某些值
184
120
  */
185
- private registerType;
186
- /** 将手动注册的 API 项预先注入注册表(确保优先级高于扫描结果) */
187
- private seedIncludedRegistrations;
188
- /** 批量注册扫描到的值导出项,跳过 exclude 列表中的名称 */
189
- private registerScannedValueItems;
190
- /** 批量注册扫描到的类型导出项,跳过 exclude 列表中的名称 */
191
- private registerScannedTypeItems;
121
+ private directApi;
192
122
  /**
193
- * 扫描一组文件,提取导出项并注册到全局注册表
194
- * @param source 所属的扫描源配置
195
- * @param filePaths 待扫描的文件路径列表
196
- * @param scanPath 扫描基准路径(用于计算相对导入路径)
197
- * @param options.includeTypes 是否解析类型导出
198
- * @param options.registerValues/registerTypes 分别控制是否注册值/类型导出
123
+ * 扫描提取
124
+ * - 纯文件
125
+ * - 路径
126
+ * - node包
127
+ * - glob语法
199
128
  */
200
- private scanSourceFiles;
129
+ private scanApi;
130
+ scanApis(): Promise<(ApiFile[] | void[] | undefined)[]>;
131
+ private findApiSource;
132
+ isApi(file: string): boolean;
133
+ enterApi(file: string): Promise<boolean>;
134
+ exitApi(file: string): boolean;
135
+ generateDeclaration(): string;
136
+ writeDeclaration(): void;
137
+ applyApis(source: string, file: string): {
138
+ code: string;
139
+ map: _$magic_string0.SourceMap;
140
+ };
141
+ }
142
+ //#endregion
143
+ //#region src/module/component/types.d.ts
144
+ interface ComponentFile {
145
+ /** 源文件在磁盘上的绝对路径 */
146
+ filePath: string;
147
+ /** 导出名称,如 'default' 或具名导出 */
148
+ exportName: string;
149
+ /** 被消费的引用命名 */
150
+ importName: string;
151
+ /** 被消费的导入绝对路径 */
152
+ importPath: string;
153
+ /** 是否位于 Node 模块中 */
154
+ isNodeModule: boolean;
155
+ }
156
+ interface ComponentScanSource extends ComponentScanTarget {
201
157
  /**
202
- * 执行完整的 API 收集流程
203
- * 1. 重置状态并注入手动注册项
204
- * 2. 遍历所有扫描源,分别处理值文件和类型文件
205
- * 3. 返回收集到的值 API 列表
158
+ * 扫描真实绝对路径
206
159
  */
207
- collectApis(): Promise<AutoApiItem[]>;
208
- /** 代理调用 collectBoundNames,收集代码中已绑定的标识符 */
209
- collectBoundNames(code: string): Set<string>;
160
+ dir: string;
210
161
  /**
211
- * 分析代码中引用了哪些已注册的自动 API,生成对应的 import 语句列表
212
- *
213
- * @param code
214
- * @param options 配置
215
- * @param options.boundNames 额外已绑定的标识符(不会被当作需要导入的引用)
162
+ * 匹配文件模式 (支持glob语法)
216
163
  */
217
- resolveImports(code: string, options?: {
218
- boundNames?: Iterable<string>;
219
- }): string[];
220
- resolveImport(name: string): string | undefined;
164
+ patterns?: string[];
221
165
  /**
222
- * 生成全局类型声明文件内容(apis.d.ts)
223
- * 包含两部分:
224
- * - 值导出的全局 const 声明(typeof import(...) 形式)
225
- * - 类型导出的 re-export 声明
166
+ * 包的导出接口,用于针对 Node module
226
167
  */
227
- generateDeclaration(): string;
228
- /** 生成类型声明内容并写入文件,同时确保 tsconfig 中包含该声明文件 */
229
- writeDeclaration(): string;
168
+ isNodeModule: boolean;
230
169
  }
231
170
  //#endregion
232
- //#region src/module/component/index.d.ts
233
- interface AutoComponentFile {
234
- componentName: string;
235
- exportName: string;
236
- filePath: string;
237
- importPath?: string;
238
- }
239
- interface RegisteredComponent {
240
- export?: string;
241
- from: string;
242
- name: string;
243
- }
244
- interface RegisteredComponentsSource {
245
- chain?: boolean;
246
- ignore?: GlobRule;
247
- importBase?: string;
248
- pattern?: GlobRule;
249
- path: string;
250
- prefix?: string;
251
- }
252
- declare function resolveScannedComponentSources(config: OiyoConfig): RegisteredComponentsSource[];
253
- declare function isScannedComponentPath(config: OiyoConfig, absPath: string): boolean;
254
- declare function resolveComponentName(filePath: string, baseDir: string, options?: {
255
- chain?: boolean;
256
- prefix?: string;
257
- }): string;
171
+ //#region src/module/component/instance.d.ts
172
+ /**
173
+ * TODO:
174
+ * - 当 config 中含多个相同(范围匹配)的 target 时合并他们。
175
+ */
258
176
  declare class OiyoModComponent {
259
- private readonly _config;
260
- autoComponents: AutoComponentFile[];
261
- private readonly registeredComponents;
262
- private readonly componentSources;
263
- private readonly autoComponentMap;
177
+ private readonly config;
264
178
  private readonly logger;
265
179
  private readonly oiyoState;
266
- constructor(_config: OiyoConfig, deps: {
180
+ private readonly oiyoApi;
181
+ private sources;
182
+ components: Map<string, ComponentFile>;
183
+ constructor(config: OiyoConfig, deps: {
267
184
  logger: Logger;
268
185
  oiyoState: OiyoState;
186
+ oiyoApi: OiyoModApi;
269
187
  });
270
- get stateDir(): string;
271
- get typesDir(): string;
272
- get declarationPath(): string;
273
- isAutoComponentPath(absPath: string): boolean;
274
- registerComponent(component: RegisteredComponent): void;
275
- registerComponents(input: string | string[] | RegisteredComponentsSource | RegisteredComponentsSource[]): void;
276
- private registerConfigScanners;
277
- private setResolvedComponent;
278
- collectComponents(): Promise<AutoComponentFile[]>;
279
- resolveComponentImports(template: string, importerPath?: string): string[];
280
- resolveComponentImport(componentName: string, importerPath?: string): string | undefined;
188
+ private get srcDir();
189
+ private get declarationDir();
190
+ private get declarationFile();
191
+ shouldSkipImport(name: string): boolean;
192
+ private recordComponentSource;
193
+ private toComponentSource;
194
+ private saveComponent;
195
+ /**
196
+ * 直接提取
197
+ * - 1.必须是 Node
198
+ * - 2.必须指定某些值
199
+ */
200
+ private scanComponentByDirect;
201
+ /**
202
+ * 扫描提取
203
+ * - 1.可以是 路径、 Node 包
204
+ * - 2.不能指定某些值
205
+ */
206
+ private scanComponentByDir;
207
+ private scanComponent;
208
+ scanComponents(): Promise<void>;
209
+ findComponentSource(file: string): ComponentScanSource | undefined;
210
+ isComponent(file: string): boolean;
211
+ enterComponent(file: string): boolean;
212
+ exitComponent(file: string): ComponentFile | undefined;
281
213
  generateDeclaration(): string;
282
- writeDeclaration(): string;
214
+ writeDeclaration(): void;
215
+ applyComponents(source: string, file: string, options?: {
216
+ /** 同时应用Api */withApis: boolean;
217
+ }): {
218
+ code: string;
219
+ map: _$magic_string0.SourceMap;
220
+ };
283
221
  }
284
222
  //#endregion
285
223
  //#region src/module/layout/types.d.ts
@@ -295,31 +233,28 @@ interface LayoutFile {
295
233
  filePath: string;
296
234
  }
297
235
  //#endregion
298
- //#region src/module/layout/placeholder.d.ts
299
- declare const OiyoLayout: _$vue.DefineComponent<{}, () => _$vue.VNode<_$vue.RendererNode, _$vue.RendererElement, {
300
- [key: string]: any;
301
- }>[] | undefined, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{}>>, {}, {}>;
302
- //#endregion
303
- //#region src/module/layout/index.d.ts
236
+ //#region src/module/layout/instance.d.ts
304
237
  declare class OiyoModLayout {
305
238
  private readonly config;
306
- layoutFiles: LayoutFile[];
307
239
  private readonly logger;
308
240
  private readonly oiyoState;
241
+ layouts: Map<string, LayoutFile>;
309
242
  constructor(config: OiyoConfig, deps: {
310
243
  logger: Logger;
311
244
  oiyoState: OiyoState;
312
245
  });
313
- get srcDir(): string;
314
- get layoutDir(): string;
315
- get stateDir(): string;
316
- get typesDir(): string;
317
- get declarationPath(): string;
318
- isLayoutPath(absPath: string): boolean;
319
- setLayout(absPath: string): boolean;
320
- registerLayouts(): Promise<LayoutFile[]>;
246
+ private get srcDir();
247
+ private get layoutDir();
248
+ get declarationDir(): string;
249
+ get declarationFile(): string;
250
+ private toLayout;
251
+ private saveLayout;
252
+ scanLayouts(): Promise<Map<string, LayoutFile>>;
253
+ isLayout(file: string): boolean;
254
+ enterLayout(file: string): boolean;
255
+ exitLayout(file: string): boolean;
321
256
  generateDeclaration(): string;
322
- writeDeclaration(): string;
257
+ writeDeclaration(): boolean;
323
258
  applyLayout(useName: string | false | undefined, template: string): {
324
259
  template: string;
325
260
  script: string;
@@ -327,6 +262,11 @@ declare class OiyoModLayout {
327
262
  };
328
263
  }
329
264
  //#endregion
265
+ //#region src/module/layout/placeholder.d.ts
266
+ declare const OiyoLayout: _$vue.DefineComponent<{}, () => _$vue.VNode<_$vue.RendererNode, _$vue.RendererElement, {
267
+ [key: string]: any;
268
+ }>[] | undefined, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{}>>, {}, {}>;
269
+ //#endregion
330
270
  //#region src/module/root/parse.d.ts
331
271
  interface ParsedRootMarco {
332
272
  /** 宏引用模块 */
@@ -342,23 +282,7 @@ interface ParsedRootMarco {
342
282
  }[];
343
283
  }
344
284
  //#endregion
345
- //#region src/module/root/macro.d.ts
346
- /**
347
- * 根上下文工厂函数
348
- */
349
- type RootContextFactory<T extends object> = () => T;
350
- /**
351
- * 定义根上下文
352
- * @param factory 返回上下文对象的工厂函数
353
- * @returns 上下文对象
354
- */
355
- declare const defineRootContext: <T extends object>(factory: RootContextFactory<T>) => T;
356
- //#endregion
357
- //#region src/module/root/virtual-module.d.ts
358
- declare const VIRTUAL_ROOT_CONTEXT_ID = "virtual:oiyo-root-context";
359
- declare const RESOLVED_VIRTUAL_ROOT_CONTEXT_ID = "\0virtual:oiyo-root-context";
360
- //#endregion
361
- //#region src/module/root/index.d.ts
285
+ //#region src/module/root/instance.d.ts
362
286
  declare class OiyoModRoot {
363
287
  readonly config: OiyoConfig;
364
288
  /** 根视图模块 */
@@ -372,10 +296,8 @@ declare class OiyoModRoot {
372
296
  /** 根宏命令结构 */
373
297
  rootMarco?: ParsedRootMarco;
374
298
  private readonly logger;
375
- private readonly oiyoAutoApi?;
376
299
  constructor(config: OiyoConfig, deps: {
377
300
  logger: Logger;
378
- oiyoAutoApi?: OiyoModApi;
379
301
  });
380
302
  get srcDir(): string;
381
303
  get rootPath(): string;
@@ -394,13 +316,29 @@ declare class OiyoModRoot {
394
316
  };
395
317
  shouldRefreshView(code: string): boolean;
396
318
  shouldRefreshVM: (code: string) => boolean;
397
- applyRoot(sfc: SFCDescriptor): {
319
+ applyRoot(pageSfc: SFCDescriptor): {
398
320
  imports: string[];
399
321
  script: string;
400
322
  template: string;
401
323
  };
402
324
  }
403
325
  //#endregion
326
+ //#region src/module/root/macro.d.ts
327
+ /**
328
+ * 根上下文工厂函数
329
+ */
330
+ type RootContextFactory<T extends object> = () => T;
331
+ /**
332
+ * 定义根上下文
333
+ * @param factory 返回上下文对象的工厂函数
334
+ * @returns 上下文对象
335
+ */
336
+ declare const defineRootContext: <T extends object>(factory: RootContextFactory<T>) => T;
337
+ //#endregion
338
+ //#region src/module/root/virtual-module.d.ts
339
+ declare const VIRTUAL_ROOT_CONTEXT_ID = "virtual:oiyo-root-context";
340
+ declare const RESOLVED_VIRTUAL_ROOT_CONTEXT_ID = "\0virtual:oiyo-root-context";
341
+ //#endregion
404
342
  //#region src/module/route/types.d.ts
405
343
  /**
406
344
  * 可序列化的页面元信息值类型
@@ -442,45 +380,17 @@ interface PageFile {
442
380
  /** 所属包(main 或子包名称) */
443
381
  pageBelong: string;
444
382
  }
445
- /**
446
- * 已解析的页面配置
447
- */
448
- interface ResolvedPagesJson extends PagesJson {
449
- /**
450
- * 设置页面路径及窗口表现
451
- */
452
- pages: Page[];
453
- }
454
383
  //#endregion
455
- //#region src/module/route/macro.d.ts
456
- /**
457
- * 页面元信息
458
- * 用户在 definePageMeta() 中使用的类型
459
- * 支持通过 declare module '@skiyee/oiyo' 进行扩展
460
- */
461
- interface PageMeta extends BasePageMeta {
462
- /** 其他自定义字段 */
463
- [key: string]: unknown;
464
- }
465
- /**
466
- * 定义页面元信息
467
- * @param meta 页面元信息配置
468
- */
469
- declare const definePageMeta: (meta: PageMeta) => void;
470
- //#endregion
471
- //#region src/module/route/placeholder.d.ts
472
- declare const OiyoPage: _$vue.DefineComponent<{}, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{}>>, {}, {}>;
473
- //#endregion
474
- //#region src/module/route/index.d.ts
384
+ //#region src/module/route/instance.d.ts
475
385
  declare class OiyoModRoute {
476
- pageFiles: PageFile[];
477
- pagesConfig: PagesConfig;
478
- pagesConfigWatcher?: ConfigWatcher<PagesConfig>;
479
386
  private readonly config;
480
387
  private readonly logger;
481
388
  private readonly oiyoState;
482
389
  private readonly oiyoRoot?;
483
390
  private readonly oiyoLayout?;
391
+ pages: Map<string, PageFile>;
392
+ private pagesConfig;
393
+ private pagesConfigWatcher?;
484
394
  constructor(config: OiyoConfig, deps: {
485
395
  logger: Logger;
486
396
  oiyoState: OiyoState;
@@ -491,57 +401,56 @@ declare class OiyoModRoute {
491
401
  oiyoRoot: OiyoModRoot;
492
402
  oiyoLayout: OiyoModLayout;
493
403
  });
494
- get srcDir(): string;
495
- get mainPageDir(): string;
496
- get subPageDirs(): string[];
497
- get pagesJsonPath(): string;
498
- get stateDir(): string;
499
- get typesDir(): string;
500
- get declarationPath(): string;
501
- resolvePagesJson(userPageJson?: PagesConfig): ResolvedPagesJson;
502
- loadPagesConfig(): Promise<PagesConfig>;
503
- watchPagesConfig(onUpdateCallback?: () => void | Promise<void>): Promise<void>;
504
- unwatchPagesConfig(): Promise<void>;
505
- /**
506
- * 检测路径是否属于页面
507
- */
508
- isPagePath(absPath: string): boolean;
509
- toPageFile(filePath: string, pageMeta: ResolvedPageMeta): PageFile;
510
- /**
511
- * 设置页面
512
- * - 支持更新/新增
513
- * @returns 若需 新增/更新 则返回 true,否则返回 false
514
- */
515
- setPageFile(newPage: PageFile): boolean;
516
- /**
517
- * 载入 pages.json
518
- */
519
- loadPagesJson(): Promise<void>;
520
- /**
521
- * 生成并写入 pages.json
522
- */
523
- writePagesJson(userPageJson?: PagesConfig): void;
404
+ private get srcDir();
405
+ private get mainPageDir();
406
+ private get subPageDirs();
407
+ private get pagesJsonFile();
408
+ private get declarationDir();
409
+ private get declarationFile();
410
+ private toPage;
411
+ private savePage;
412
+ private loadPagesConfig;
413
+ private loadPagesJson;
414
+ scanPages(): Promise<Map<string, PageFile>>;
415
+ isPage(file: string): boolean;
416
+ enterPage(file: string): boolean;
417
+ exitPage(file: string): boolean;
418
+ private resolvePagesJson;
419
+ writePagesJson(userPageJson?: PagesConfig): boolean;
524
420
  generateDeclaration(userPageJson?: PagesConfig): string;
525
421
  writeDeclaration(userPageJson?: PagesConfig): string;
526
- /**
527
- * 注册所有页面
528
- * - 扫描页面
529
- * - 提取宏命令
530
- * - 注册页面
531
- */
532
- registerPages(): Promise<PageFile[]>;
533
- tryUpdatePage(scriptContent: string, filePath: string): Promise<void>;
534
- transformPage(source: string, filePath: string): Promise<{
422
+ watchPagesConfig(onUpdateCallback?: () => void | Promise<void>): Promise<void>;
423
+ unwatchPagesConfig(): Promise<void>;
424
+ transformPage(source: string, file: string): Promise<{
535
425
  code: string;
536
426
  sourceMap: _$magic_string0.SourceMap;
537
427
  }>;
538
428
  }
539
429
  //#endregion
430
+ //#region src/module/route/macro.d.ts
431
+ /**
432
+ * 页面元信息
433
+ * 用户在 definePageMeta() 中使用的类型
434
+ * 支持通过 declare module '@skiyee/oiyo' 进行扩展
435
+ */
436
+ interface PageMeta extends BasePageMeta {
437
+ /** 其他自定义字段 */
438
+ [key: string]: unknown;
439
+ }
440
+ /**
441
+ * 定义页面元信息
442
+ * @param meta 页面元信息配置
443
+ */
444
+ declare const definePageMeta: (meta: PageMeta) => void;
445
+ //#endregion
446
+ //#region src/module/route/placeholder.d.ts
447
+ declare const OiyoPage: _$vue.DefineComponent<{}, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{}>>, {}, {}>;
448
+ //#endregion
540
449
  //#region src/plugin/context.d.ts
541
450
  interface OiyoContext {
542
451
  config: OiyoConfig;
543
- autoApi: OiyoModApi;
544
- autoComponent: OiyoModComponent;
452
+ api: OiyoModApi;
453
+ component: OiyoModComponent;
545
454
  logger: Logger;
546
455
  layout: OiyoModLayout;
547
456
  state: OiyoState;
@@ -557,4 +466,4 @@ declare module 'vite' {
557
466
  }
558
467
  declare function OiyoCorePlugin(options?: OiyoConfig): Plugin[];
559
468
  //#endregion
560
- export { type AutoApiItem, AutoComponentFile, type IncludedApi, type IncludedApisSource, LogErrorOptions, LogLevel, LogLevels, LogOptions, LogType, Logger, LoggerOptions, OiyoCorePlugin, OiyoLayout, OiyoMetadata, OiyoModApi, OiyoModComponent, OiyoModLayout, OiyoModRoot, OiyoModRoute, OiyoPage, OiyoState, type PageMeta, RESOLVED_VIRTUAL_ROOT_CONTEXT_ID, RegisteredComponent, RegisteredComponentsSource, VIRTUAL_ROOT_CONTEXT_ID, createLogger, definePageMeta, defineRootContext, isScannedComponentPath, resolveComponentName, resolveScannedComponentSources };
469
+ export { LogErrorOptions, LogLevel, LogLevels, LogOptions, LogType, Logger, LoggerOptions, OiyoCorePlugin, OiyoLayout, OiyoMetadata, OiyoModApi, OiyoModComponent, OiyoModLayout, OiyoModRoot, OiyoModRoute, OiyoPage, OiyoState, type PageMeta, RESOLVED_VIRTUAL_ROOT_CONTEXT_ID, VIRTUAL_ROOT_CONTEXT_ID, createLogger, definePageMeta, defineRootContext };