@oiyo/core 0.3.0 → 0.3.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,5 +1,5 @@
1
1
  /**
2
- * @oiyo/core v0.3.0
2
+ * @oiyo/core v0.3.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
@@ -43,17 +43,11 @@ declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger
43
43
  //#endregion
44
44
  //#region src/module/api/types.d.ts
45
45
  interface ApiFile {
46
- /** 源文件在磁盘上的绝对路径 */
47
46
  filePath: string;
48
- /** 导出名称,如 'default' 或具名导出 */
49
47
  exportName: string;
50
- /** 被消费的导入绝对路径 */
51
48
  importPath: string;
52
- /** 被消费的引用命名 */
53
49
  importName: string;
54
- /** 是否为类型 */
55
50
  isType: boolean;
56
- /** 是否位于 Node 模块中 */
57
51
  isNodeModule: boolean;
58
52
  }
59
53
  //#endregion
@@ -98,7 +92,6 @@ declare class OiyoModApi {
98
92
  private readonly config;
99
93
  private readonly logger;
100
94
  private readonly oiyoState;
101
- /** 不含有 only 的 ApiScanTarget */
102
95
  private sources;
103
96
  apis: Map<string, ApiFile>;
104
97
  constructor(config: OiyoConfig, deps: {
@@ -112,19 +105,7 @@ declare class OiyoModApi {
112
105
  private recordApiSource;
113
106
  private toApiSource;
114
107
  private saveApi;
115
- /**
116
- * 直接提取
117
- * - 1.必须是 Node 包
118
- * - 2.必须指定某些值
119
- */
120
108
  private directApi;
121
- /**
122
- * 扫描提取
123
- * - 纯文件
124
- * - 路径
125
- * - node包
126
- * - glob语法
127
- */
128
109
  private scanApi;
129
110
  scanApis(): Promise<(ApiFile[] | void[] | undefined)[]>;
130
111
  private findApiSource;
@@ -141,37 +122,19 @@ declare class OiyoModApi {
141
122
  //#endregion
142
123
  //#region src/module/component/types.d.ts
143
124
  interface ComponentFile {
144
- /** 源文件在磁盘上的绝对路径 */
145
125
  filePath: string;
146
- /** 导出名称,如 'default' 或具名导出 */
147
126
  exportName: string;
148
- /** 被消费的引用命名 */
149
127
  importName: string;
150
- /** 被消费的导入绝对路径 */
151
128
  importPath: string;
152
- /** 是否位于 Node 模块中 */
153
129
  isNodeModule: boolean;
154
130
  }
155
131
  interface ComponentScanSource extends ComponentScanTarget {
156
- /**
157
- * 扫描真实绝对路径
158
- */
159
132
  dir: string;
160
- /**
161
- * 匹配文件模式 (支持glob语法)
162
- */
163
133
  patterns?: string[];
164
- /**
165
- * 包的导出接口,用于针对 Node module
166
- */
167
134
  isNodeModule: boolean;
168
135
  }
169
136
  //#endregion
170
137
  //#region src/module/component/instance.d.ts
171
- /**
172
- * TODO:
173
- * - 当 config 中含多个相同(范围匹配)的 target 时合并他们。
174
- */
175
138
  declare class OiyoModComponent {
176
139
  private readonly config;
177
140
  private readonly logger;
@@ -191,17 +154,7 @@ declare class OiyoModComponent {
191
154
  private recordComponentSource;
192
155
  private toComponentSource;
193
156
  private saveComponent;
194
- /**
195
- * 直接提取
196
- * - 1.必须是 Node 包
197
- * - 2.必须指定某些值
198
- */
199
157
  private scanComponentByDirect;
200
- /**
201
- * 扫描提取
202
- * - 1.可以是 路径、 Node 包
203
- * - 2.不能指定某些值
204
- */
205
158
  private scanComponentByDir;
206
159
  private scanComponent;
207
160
  scanComponents(): Promise<void>;
@@ -212,7 +165,7 @@ declare class OiyoModComponent {
212
165
  generateDeclaration(): string;
213
166
  writeDeclaration(): void;
214
167
  applyComponents(source: string, file: string, options?: {
215
- /** 同时应用Api */withApis: boolean;
168
+ withApis: boolean;
216
169
  }): {
217
170
  code: string;
218
171
  map: _$magic_string0.SourceMap;
@@ -220,15 +173,9 @@ declare class OiyoModComponent {
220
173
  }
221
174
  //#endregion
222
175
  //#region src/module/layout/types.d.ts
223
- /**
224
- * 布局信息
225
- */
226
176
  interface LayoutFile {
227
- /** 布局应用名称 */
228
177
  useName: string;
229
- /** 布局组件名称 */
230
178
  componentName: string;
231
- /** 布局文件的绝对路径 */
232
179
  filePath: string;
233
180
  }
234
181
  //#endregion
@@ -277,7 +224,6 @@ declare class OiyoModRoot {
277
224
  rootTemplateScript: string;
278
225
  rootMarcoImports: Map<string, ImportInfo>;
279
226
  rootMarcoScript: string;
280
- /** 根虚拟模块 */
281
227
  rootVM?: string;
282
228
  constructor(config: OiyoConfig, deps: {
283
229
  logger: Logger;
@@ -295,15 +241,7 @@ declare class OiyoModRoot {
295
241
  }
296
242
  //#endregion
297
243
  //#region src/module/root/macro.d.ts
298
- /**
299
- * 根上下文工厂函数
300
- */
301
244
  type RootContextFactory<T extends object> = () => T;
302
- /**
303
- * 定义根上下文
304
- * @param factory 返回上下文对象的工厂函数
305
- * @returns 上下文对象
306
- */
307
245
  declare const defineRootContext: <T extends object>(factory: RootContextFactory<T>) => T;
308
246
  //#endregion
309
247
  //#region src/module/root/virtual-module.d.ts
@@ -311,44 +249,20 @@ declare const VIRTUAL_ROOT_CONTEXT_ID = "virtual:oiyo-root-context";
311
249
  declare const RESOLVED_VIRTUAL_ROOT_CONTEXT_ID = "\0virtual:oiyo-root-context";
312
250
  //#endregion
313
251
  //#region src/module/route/types.d.ts
314
- /**
315
- * 可序列化的页面元信息值类型
316
- * 用于静态提取和 pages.json 生成
317
- */
318
252
  type PageMetaValue = string | number | boolean | null | PageMetaObject | PageMetaValue[];
319
- /**
320
- * 可序列化的页面元信息对象
321
- */
322
253
  interface PageMetaObject {
323
254
  [key: string]: PageMetaValue | undefined;
324
255
  }
325
- /**
326
- * 页面元信息基础字段
327
- */
328
256
  interface BasePageMeta {
329
- /** 页面类型 */
330
257
  type?: 'page' | 'home';
331
- /** 使用的布局名称,false 表示不使用布局 */
332
258
  layout?: string | false;
333
- /** uni-app 页面样式配置 */
334
259
  style?: GlobalStyle;
335
260
  }
336
- /**
337
- * 已解析的页面元信息
338
- * 用于编译期静态提取和 pages.json 生成
339
- */
340
261
  interface ResolvedPageMeta extends BasePageMeta, PageMetaObject {}
341
- /**
342
- * 页面文件信息
343
- */
344
262
  interface PageFile {
345
- /** 页面路径(相对于 srcDir,不含扩展名) */
346
263
  pagePath: string;
347
- /** 页面文件的绝对路径 */
348
264
  filePath: string;
349
- /** 页面元信息 */
350
265
  pageMeta: ResolvedPageMeta;
351
- /** 所属包(main 或子包名称) */
352
266
  pageBelong: string;
353
267
  }
354
268
  //#endregion
@@ -403,19 +317,9 @@ declare class OiyoModRoute {
403
317
  }
404
318
  //#endregion
405
319
  //#region src/module/route/macro.d.ts
406
- /**
407
- * 页面元信息
408
- * 用户在 definePageMeta() 中使用的类型
409
- * 支持通过 declare module '@skiyee/oiyo' 进行扩展
410
- */
411
320
  interface PageMeta extends BasePageMeta {
412
- /** 其他自定义字段 */
413
321
  [key: string]: unknown;
414
322
  }
415
- /**
416
- * 定义页面元信息
417
- * @param meta 页面元信息配置
418
- */
419
323
  declare const definePageMeta: (meta: PageMeta) => void;
420
324
  //#endregion
421
325
  //#region src/module/route/placeholder.d.ts
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @oiyo/core v0.3.0
2
+ * @oiyo/core v0.3.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
@@ -43,17 +43,11 @@ declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger
43
43
  //#endregion
44
44
  //#region src/module/api/types.d.ts
45
45
  interface ApiFile {
46
- /** 源文件在磁盘上的绝对路径 */
47
46
  filePath: string;
48
- /** 导出名称,如 'default' 或具名导出 */
49
47
  exportName: string;
50
- /** 被消费的导入绝对路径 */
51
48
  importPath: string;
52
- /** 被消费的引用命名 */
53
49
  importName: string;
54
- /** 是否为类型 */
55
50
  isType: boolean;
56
- /** 是否位于 Node 模块中 */
57
51
  isNodeModule: boolean;
58
52
  }
59
53
  //#endregion
@@ -98,7 +92,6 @@ declare class OiyoModApi {
98
92
  private readonly config;
99
93
  private readonly logger;
100
94
  private readonly oiyoState;
101
- /** 不含有 only 的 ApiScanTarget */
102
95
  private sources;
103
96
  apis: Map<string, ApiFile>;
104
97
  constructor(config: OiyoConfig, deps: {
@@ -112,19 +105,7 @@ declare class OiyoModApi {
112
105
  private recordApiSource;
113
106
  private toApiSource;
114
107
  private saveApi;
115
- /**
116
- * 直接提取
117
- * - 1.必须是 Node 包
118
- * - 2.必须指定某些值
119
- */
120
108
  private directApi;
121
- /**
122
- * 扫描提取
123
- * - 纯文件
124
- * - 路径
125
- * - node包
126
- * - glob语法
127
- */
128
109
  private scanApi;
129
110
  scanApis(): Promise<(ApiFile[] | void[] | undefined)[]>;
130
111
  private findApiSource;
@@ -141,37 +122,19 @@ declare class OiyoModApi {
141
122
  //#endregion
142
123
  //#region src/module/component/types.d.ts
143
124
  interface ComponentFile {
144
- /** 源文件在磁盘上的绝对路径 */
145
125
  filePath: string;
146
- /** 导出名称,如 'default' 或具名导出 */
147
126
  exportName: string;
148
- /** 被消费的引用命名 */
149
127
  importName: string;
150
- /** 被消费的导入绝对路径 */
151
128
  importPath: string;
152
- /** 是否位于 Node 模块中 */
153
129
  isNodeModule: boolean;
154
130
  }
155
131
  interface ComponentScanSource extends ComponentScanTarget {
156
- /**
157
- * 扫描真实绝对路径
158
- */
159
132
  dir: string;
160
- /**
161
- * 匹配文件模式 (支持glob语法)
162
- */
163
133
  patterns?: string[];
164
- /**
165
- * 包的导出接口,用于针对 Node module
166
- */
167
134
  isNodeModule: boolean;
168
135
  }
169
136
  //#endregion
170
137
  //#region src/module/component/instance.d.ts
171
- /**
172
- * TODO:
173
- * - 当 config 中含多个相同(范围匹配)的 target 时合并他们。
174
- */
175
138
  declare class OiyoModComponent {
176
139
  private readonly config;
177
140
  private readonly logger;
@@ -191,17 +154,7 @@ declare class OiyoModComponent {
191
154
  private recordComponentSource;
192
155
  private toComponentSource;
193
156
  private saveComponent;
194
- /**
195
- * 直接提取
196
- * - 1.必须是 Node 包
197
- * - 2.必须指定某些值
198
- */
199
157
  private scanComponentByDirect;
200
- /**
201
- * 扫描提取
202
- * - 1.可以是 路径、 Node 包
203
- * - 2.不能指定某些值
204
- */
205
158
  private scanComponentByDir;
206
159
  private scanComponent;
207
160
  scanComponents(): Promise<void>;
@@ -212,7 +165,7 @@ declare class OiyoModComponent {
212
165
  generateDeclaration(): string;
213
166
  writeDeclaration(): void;
214
167
  applyComponents(source: string, file: string, options?: {
215
- /** 同时应用Api */withApis: boolean;
168
+ withApis: boolean;
216
169
  }): {
217
170
  code: string;
218
171
  map: _$magic_string0.SourceMap;
@@ -220,15 +173,9 @@ declare class OiyoModComponent {
220
173
  }
221
174
  //#endregion
222
175
  //#region src/module/layout/types.d.ts
223
- /**
224
- * 布局信息
225
- */
226
176
  interface LayoutFile {
227
- /** 布局应用名称 */
228
177
  useName: string;
229
- /** 布局组件名称 */
230
178
  componentName: string;
231
- /** 布局文件的绝对路径 */
232
179
  filePath: string;
233
180
  }
234
181
  //#endregion
@@ -277,7 +224,6 @@ declare class OiyoModRoot {
277
224
  rootTemplateScript: string;
278
225
  rootMarcoImports: Map<string, ImportInfo>;
279
226
  rootMarcoScript: string;
280
- /** 根虚拟模块 */
281
227
  rootVM?: string;
282
228
  constructor(config: OiyoConfig, deps: {
283
229
  logger: Logger;
@@ -295,15 +241,7 @@ declare class OiyoModRoot {
295
241
  }
296
242
  //#endregion
297
243
  //#region src/module/root/macro.d.ts
298
- /**
299
- * 根上下文工厂函数
300
- */
301
244
  type RootContextFactory<T extends object> = () => T;
302
- /**
303
- * 定义根上下文
304
- * @param factory 返回上下文对象的工厂函数
305
- * @returns 上下文对象
306
- */
307
245
  declare const defineRootContext: <T extends object>(factory: RootContextFactory<T>) => T;
308
246
  //#endregion
309
247
  //#region src/module/root/virtual-module.d.ts
@@ -311,44 +249,20 @@ declare const VIRTUAL_ROOT_CONTEXT_ID = "virtual:oiyo-root-context";
311
249
  declare const RESOLVED_VIRTUAL_ROOT_CONTEXT_ID = "\0virtual:oiyo-root-context";
312
250
  //#endregion
313
251
  //#region src/module/route/types.d.ts
314
- /**
315
- * 可序列化的页面元信息值类型
316
- * 用于静态提取和 pages.json 生成
317
- */
318
252
  type PageMetaValue = string | number | boolean | null | PageMetaObject | PageMetaValue[];
319
- /**
320
- * 可序列化的页面元信息对象
321
- */
322
253
  interface PageMetaObject {
323
254
  [key: string]: PageMetaValue | undefined;
324
255
  }
325
- /**
326
- * 页面元信息基础字段
327
- */
328
256
  interface BasePageMeta {
329
- /** 页面类型 */
330
257
  type?: 'page' | 'home';
331
- /** 使用的布局名称,false 表示不使用布局 */
332
258
  layout?: string | false;
333
- /** uni-app 页面样式配置 */
334
259
  style?: GlobalStyle;
335
260
  }
336
- /**
337
- * 已解析的页面元信息
338
- * 用于编译期静态提取和 pages.json 生成
339
- */
340
261
  interface ResolvedPageMeta extends BasePageMeta, PageMetaObject {}
341
- /**
342
- * 页面文件信息
343
- */
344
262
  interface PageFile {
345
- /** 页面路径(相对于 srcDir,不含扩展名) */
346
263
  pagePath: string;
347
- /** 页面文件的绝对路径 */
348
264
  filePath: string;
349
- /** 页面元信息 */
350
265
  pageMeta: ResolvedPageMeta;
351
- /** 所属包(main 或子包名称) */
352
266
  pageBelong: string;
353
267
  }
354
268
  //#endregion
@@ -403,19 +317,9 @@ declare class OiyoModRoute {
403
317
  }
404
318
  //#endregion
405
319
  //#region src/module/route/macro.d.ts
406
- /**
407
- * 页面元信息
408
- * 用户在 definePageMeta() 中使用的类型
409
- * 支持通过 declare module '@skiyee/oiyo' 进行扩展
410
- */
411
320
  interface PageMeta extends BasePageMeta {
412
- /** 其他自定义字段 */
413
321
  [key: string]: unknown;
414
322
  }
415
- /**
416
- * 定义页面元信息
417
- * @param meta 页面元信息配置
418
- */
419
323
  declare const definePageMeta: (meta: PageMeta) => void;
420
324
  //#endregion
421
325
  //#region src/module/route/placeholder.d.ts