@oiyo/core 0.3.0-beta.3 → 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.cjs +2 -21
- package/dist/index.d.cts +20 -141
- package/dist/index.d.mts +20 -141
- package/dist/index.mjs +2 -21
- package/package.json +5 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @oiyo/core v0.3.
|
|
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
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
import * as _$magic_string0 from "magic-string";
|
|
8
8
|
import { ComponentScanTarget, GlobalStyle, OiyoConfig, PagesConfig } from "@oiyo/config";
|
|
9
9
|
import * as _$vue from "vue";
|
|
10
|
-
import { SFCDescriptor } from "@vue/compiler-sfc";
|
|
11
10
|
import { Plugin } from "vite";
|
|
12
11
|
|
|
13
12
|
//#region src/logger.d.ts
|
|
@@ -44,17 +43,11 @@ declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger
|
|
|
44
43
|
//#endregion
|
|
45
44
|
//#region src/module/api/types.d.ts
|
|
46
45
|
interface ApiFile {
|
|
47
|
-
/** 源文件在磁盘上的绝对路径 */
|
|
48
46
|
filePath: string;
|
|
49
|
-
/** 导出名称,如 'default' 或具名导出 */
|
|
50
47
|
exportName: string;
|
|
51
|
-
/** 被消费的导入绝对路径 */
|
|
52
48
|
importPath: string;
|
|
53
|
-
/** 被消费的引用命名 */
|
|
54
49
|
importName: string;
|
|
55
|
-
/** 是否为类型 */
|
|
56
50
|
isType: boolean;
|
|
57
|
-
/** 是否位于 Node 模块中 */
|
|
58
51
|
isNodeModule: boolean;
|
|
59
52
|
}
|
|
60
53
|
//#endregion
|
|
@@ -99,7 +92,6 @@ declare class OiyoModApi {
|
|
|
99
92
|
private readonly config;
|
|
100
93
|
private readonly logger;
|
|
101
94
|
private readonly oiyoState;
|
|
102
|
-
/** 不含有 only 的 ApiScanTarget */
|
|
103
95
|
private sources;
|
|
104
96
|
apis: Map<string, ApiFile>;
|
|
105
97
|
constructor(config: OiyoConfig, deps: {
|
|
@@ -113,19 +105,7 @@ declare class OiyoModApi {
|
|
|
113
105
|
private recordApiSource;
|
|
114
106
|
private toApiSource;
|
|
115
107
|
private saveApi;
|
|
116
|
-
/**
|
|
117
|
-
* 直接提取
|
|
118
|
-
* - 1.必须是 Node 包
|
|
119
|
-
* - 2.必须指定某些值
|
|
120
|
-
*/
|
|
121
108
|
private directApi;
|
|
122
|
-
/**
|
|
123
|
-
* 扫描提取
|
|
124
|
-
* - 纯文件
|
|
125
|
-
* - 路径
|
|
126
|
-
* - node包
|
|
127
|
-
* - glob语法
|
|
128
|
-
*/
|
|
129
109
|
private scanApi;
|
|
130
110
|
scanApis(): Promise<(ApiFile[] | void[] | undefined)[]>;
|
|
131
111
|
private findApiSource;
|
|
@@ -142,37 +122,19 @@ declare class OiyoModApi {
|
|
|
142
122
|
//#endregion
|
|
143
123
|
//#region src/module/component/types.d.ts
|
|
144
124
|
interface ComponentFile {
|
|
145
|
-
/** 源文件在磁盘上的绝对路径 */
|
|
146
125
|
filePath: string;
|
|
147
|
-
/** 导出名称,如 'default' 或具名导出 */
|
|
148
126
|
exportName: string;
|
|
149
|
-
/** 被消费的引用命名 */
|
|
150
127
|
importName: string;
|
|
151
|
-
/** 被消费的导入绝对路径 */
|
|
152
128
|
importPath: string;
|
|
153
|
-
/** 是否位于 Node 模块中 */
|
|
154
129
|
isNodeModule: boolean;
|
|
155
130
|
}
|
|
156
131
|
interface ComponentScanSource extends ComponentScanTarget {
|
|
157
|
-
/**
|
|
158
|
-
* 扫描真实绝对路径
|
|
159
|
-
*/
|
|
160
132
|
dir: string;
|
|
161
|
-
/**
|
|
162
|
-
* 匹配文件模式 (支持glob语法)
|
|
163
|
-
*/
|
|
164
133
|
patterns?: string[];
|
|
165
|
-
/**
|
|
166
|
-
* 包的导出接口,用于针对 Node module
|
|
167
|
-
*/
|
|
168
134
|
isNodeModule: boolean;
|
|
169
135
|
}
|
|
170
136
|
//#endregion
|
|
171
137
|
//#region src/module/component/instance.d.ts
|
|
172
|
-
/**
|
|
173
|
-
* TODO:
|
|
174
|
-
* - 当 config 中含多个相同(范围匹配)的 target 时合并他们。
|
|
175
|
-
*/
|
|
176
138
|
declare class OiyoModComponent {
|
|
177
139
|
private readonly config;
|
|
178
140
|
private readonly logger;
|
|
@@ -192,17 +154,7 @@ declare class OiyoModComponent {
|
|
|
192
154
|
private recordComponentSource;
|
|
193
155
|
private toComponentSource;
|
|
194
156
|
private saveComponent;
|
|
195
|
-
/**
|
|
196
|
-
* 直接提取
|
|
197
|
-
* - 1.必须是 Node 包
|
|
198
|
-
* - 2.必须指定某些值
|
|
199
|
-
*/
|
|
200
157
|
private scanComponentByDirect;
|
|
201
|
-
/**
|
|
202
|
-
* 扫描提取
|
|
203
|
-
* - 1.可以是 路径、 Node 包
|
|
204
|
-
* - 2.不能指定某些值
|
|
205
|
-
*/
|
|
206
158
|
private scanComponentByDir;
|
|
207
159
|
private scanComponent;
|
|
208
160
|
scanComponents(): Promise<void>;
|
|
@@ -213,7 +165,7 @@ declare class OiyoModComponent {
|
|
|
213
165
|
generateDeclaration(): string;
|
|
214
166
|
writeDeclaration(): void;
|
|
215
167
|
applyComponents(source: string, file: string, options?: {
|
|
216
|
-
|
|
168
|
+
withApis: boolean;
|
|
217
169
|
}): {
|
|
218
170
|
code: string;
|
|
219
171
|
map: _$magic_string0.SourceMap;
|
|
@@ -221,15 +173,9 @@ declare class OiyoModComponent {
|
|
|
221
173
|
}
|
|
222
174
|
//#endregion
|
|
223
175
|
//#region src/module/layout/types.d.ts
|
|
224
|
-
/**
|
|
225
|
-
* 布局信息
|
|
226
|
-
*/
|
|
227
176
|
interface LayoutFile {
|
|
228
|
-
/** 布局应用名称 */
|
|
229
177
|
useName: string;
|
|
230
|
-
/** 布局组件名称 */
|
|
231
178
|
componentName: string;
|
|
232
|
-
/** 布局文件的绝对路径 */
|
|
233
179
|
filePath: string;
|
|
234
180
|
}
|
|
235
181
|
//#endregion
|
|
@@ -255,11 +201,6 @@ declare class OiyoModLayout {
|
|
|
255
201
|
exitLayout(file: string): boolean;
|
|
256
202
|
generateDeclaration(): string;
|
|
257
203
|
writeDeclaration(): boolean;
|
|
258
|
-
applyLayout(useName: string | false | undefined, template: string): {
|
|
259
|
-
template: string;
|
|
260
|
-
script: string;
|
|
261
|
-
imports: string[];
|
|
262
|
-
};
|
|
263
204
|
}
|
|
264
205
|
//#endregion
|
|
265
206
|
//#region src/module/layout/placeholder.d.ts
|
|
@@ -267,72 +208,40 @@ declare const OiyoLayout: _$vue.DefineComponent<{}, () => _$vue.VNode<_$vue.Rend
|
|
|
267
208
|
[key: string]: any;
|
|
268
209
|
}>[] | undefined, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
269
210
|
//#endregion
|
|
270
|
-
//#region src/module/
|
|
271
|
-
interface
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
script?: string;
|
|
276
|
-
/** 宏普通赋值的变量名,如 `const state = defineRootContext(...)` 中的 `state` */
|
|
277
|
-
variable?: string;
|
|
278
|
-
/** 宏解构赋值的属性列表,如 `const { count, user: u } = defineRootContext(...)` */
|
|
279
|
-
properties?: {
|
|
280
|
-
/** 本地变量名(解构后使用的名字) */local: string; /** 原始属性名(对象中的 key) */
|
|
281
|
-
original: string;
|
|
282
|
-
}[];
|
|
211
|
+
//#region src/module/shared/extractor/import.d.ts
|
|
212
|
+
interface ImportInfo {
|
|
213
|
+
importPath: string;
|
|
214
|
+
exportName: string;
|
|
215
|
+
importName: string;
|
|
283
216
|
}
|
|
284
217
|
//#endregion
|
|
285
218
|
//#region src/module/root/instance.d.ts
|
|
286
219
|
declare class OiyoModRoot {
|
|
287
220
|
readonly config: OiyoConfig;
|
|
288
|
-
/** 根视图模块 */
|
|
289
|
-
rootView: {
|
|
290
|
-
imports: string[];
|
|
291
|
-
template: string;
|
|
292
|
-
script: string;
|
|
293
|
-
};
|
|
294
|
-
/** 根虚拟模块 */
|
|
295
|
-
rootVM?: string;
|
|
296
|
-
/** 根宏命令结构 */
|
|
297
|
-
rootMarco?: ParsedRootMarco;
|
|
298
221
|
private readonly logger;
|
|
222
|
+
rootTemplateImports: Map<string, ImportInfo>;
|
|
223
|
+
rootTemplateContent: string;
|
|
224
|
+
rootTemplateScript: string;
|
|
225
|
+
rootMarcoImports: Map<string, ImportInfo>;
|
|
226
|
+
rootMarcoScript: string;
|
|
227
|
+
rootVM?: string;
|
|
299
228
|
constructor(config: OiyoConfig, deps: {
|
|
300
229
|
logger: Logger;
|
|
301
230
|
});
|
|
302
231
|
get srcDir(): string;
|
|
303
232
|
get rootPath(): string;
|
|
304
233
|
isRootPath(absPath: string): boolean;
|
|
305
|
-
parseRoot(source: string):
|
|
306
|
-
view: {
|
|
307
|
-
imports: string[];
|
|
308
|
-
template: string;
|
|
309
|
-
script: string;
|
|
310
|
-
};
|
|
311
|
-
marco: ParsedRootMarco | undefined;
|
|
312
|
-
};
|
|
234
|
+
parseRoot(source: string): boolean;
|
|
313
235
|
transformRoot(source: string): {
|
|
314
236
|
code: string;
|
|
315
|
-
|
|
237
|
+
map: _$magic_string0.SourceMap;
|
|
316
238
|
};
|
|
317
239
|
shouldRefreshView(code: string): boolean;
|
|
318
240
|
shouldRefreshVM: (code: string) => boolean;
|
|
319
|
-
applyRoot(pageSfc: SFCDescriptor): {
|
|
320
|
-
imports: string[];
|
|
321
|
-
script: string;
|
|
322
|
-
template: string;
|
|
323
|
-
};
|
|
324
241
|
}
|
|
325
242
|
//#endregion
|
|
326
243
|
//#region src/module/root/macro.d.ts
|
|
327
|
-
/**
|
|
328
|
-
* 根上下文工厂函数
|
|
329
|
-
*/
|
|
330
244
|
type RootContextFactory<T extends object> = () => T;
|
|
331
|
-
/**
|
|
332
|
-
* 定义根上下文
|
|
333
|
-
* @param factory 返回上下文对象的工厂函数
|
|
334
|
-
* @returns 上下文对象
|
|
335
|
-
*/
|
|
336
245
|
declare const defineRootContext: <T extends object>(factory: RootContextFactory<T>) => T;
|
|
337
246
|
//#endregion
|
|
338
247
|
//#region src/module/root/virtual-module.d.ts
|
|
@@ -340,44 +249,20 @@ declare const VIRTUAL_ROOT_CONTEXT_ID = "virtual:oiyo-root-context";
|
|
|
340
249
|
declare const RESOLVED_VIRTUAL_ROOT_CONTEXT_ID = "\0virtual:oiyo-root-context";
|
|
341
250
|
//#endregion
|
|
342
251
|
//#region src/module/route/types.d.ts
|
|
343
|
-
/**
|
|
344
|
-
* 可序列化的页面元信息值类型
|
|
345
|
-
* 用于静态提取和 pages.json 生成
|
|
346
|
-
*/
|
|
347
252
|
type PageMetaValue = string | number | boolean | null | PageMetaObject | PageMetaValue[];
|
|
348
|
-
/**
|
|
349
|
-
* 可序列化的页面元信息对象
|
|
350
|
-
*/
|
|
351
253
|
interface PageMetaObject {
|
|
352
254
|
[key: string]: PageMetaValue | undefined;
|
|
353
255
|
}
|
|
354
|
-
/**
|
|
355
|
-
* 页面元信息基础字段
|
|
356
|
-
*/
|
|
357
256
|
interface BasePageMeta {
|
|
358
|
-
/** 页面类型 */
|
|
359
257
|
type?: 'page' | 'home';
|
|
360
|
-
/** 使用的布局名称,false 表示不使用布局 */
|
|
361
258
|
layout?: string | false;
|
|
362
|
-
/** uni-app 页面样式配置 */
|
|
363
259
|
style?: GlobalStyle;
|
|
364
260
|
}
|
|
365
|
-
/**
|
|
366
|
-
* 已解析的页面元信息
|
|
367
|
-
* 用于编译期静态提取和 pages.json 生成
|
|
368
|
-
*/
|
|
369
261
|
interface ResolvedPageMeta extends BasePageMeta, PageMetaObject {}
|
|
370
|
-
/**
|
|
371
|
-
* 页面文件信息
|
|
372
|
-
*/
|
|
373
262
|
interface PageFile {
|
|
374
|
-
/** 页面路径(相对于 srcDir,不含扩展名) */
|
|
375
263
|
pagePath: string;
|
|
376
|
-
/** 页面文件的绝对路径 */
|
|
377
264
|
filePath: string;
|
|
378
|
-
/** 页面元信息 */
|
|
379
265
|
pageMeta: ResolvedPageMeta;
|
|
380
|
-
/** 所属包(main 或子包名称) */
|
|
381
266
|
pageBelong: string;
|
|
382
267
|
}
|
|
383
268
|
//#endregion
|
|
@@ -410,7 +295,6 @@ declare class OiyoModRoute {
|
|
|
410
295
|
private toPage;
|
|
411
296
|
private savePage;
|
|
412
297
|
private loadPagesConfig;
|
|
413
|
-
private loadPagesJson;
|
|
414
298
|
scanPages(): Promise<Map<string, PageFile>>;
|
|
415
299
|
isPage(file: string): boolean;
|
|
416
300
|
enterPage(file: string): boolean;
|
|
@@ -422,25 +306,20 @@ declare class OiyoModRoute {
|
|
|
422
306
|
watchPagesConfig(onUpdateCallback?: () => void | Promise<void>): Promise<void>;
|
|
423
307
|
unwatchPagesConfig(): Promise<void>;
|
|
424
308
|
transformPage(source: string, file: string): Promise<{
|
|
309
|
+
code: string;
|
|
310
|
+
map: _$magic_string0.SourceMap;
|
|
311
|
+
sourceMap?: undefined;
|
|
312
|
+
} | {
|
|
425
313
|
code: string;
|
|
426
314
|
sourceMap: _$magic_string0.SourceMap;
|
|
315
|
+
map?: undefined;
|
|
427
316
|
}>;
|
|
428
317
|
}
|
|
429
318
|
//#endregion
|
|
430
319
|
//#region src/module/route/macro.d.ts
|
|
431
|
-
/**
|
|
432
|
-
* 页面元信息
|
|
433
|
-
* 用户在 definePageMeta() 中使用的类型
|
|
434
|
-
* 支持通过 declare module '@skiyee/oiyo' 进行扩展
|
|
435
|
-
*/
|
|
436
320
|
interface PageMeta extends BasePageMeta {
|
|
437
|
-
/** 其他自定义字段 */
|
|
438
321
|
[key: string]: unknown;
|
|
439
322
|
}
|
|
440
|
-
/**
|
|
441
|
-
* 定义页面元信息
|
|
442
|
-
* @param meta 页面元信息配置
|
|
443
|
-
*/
|
|
444
323
|
declare const definePageMeta: (meta: PageMeta) => void;
|
|
445
324
|
//#endregion
|
|
446
325
|
//#region src/module/route/placeholder.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @oiyo/core v0.3.
|
|
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
|
|
6
6
|
*/
|
|
7
7
|
import * as _$magic_string0 from "magic-string";
|
|
8
|
-
import { SFCDescriptor } from "@vue/compiler-sfc";
|
|
9
8
|
import { ComponentScanTarget, GlobalStyle, OiyoConfig, PagesConfig } from "@oiyo/config";
|
|
10
9
|
import * as _$vue from "vue";
|
|
11
10
|
import { Plugin } from "vite";
|
|
@@ -44,17 +43,11 @@ declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger
|
|
|
44
43
|
//#endregion
|
|
45
44
|
//#region src/module/api/types.d.ts
|
|
46
45
|
interface ApiFile {
|
|
47
|
-
/** 源文件在磁盘上的绝对路径 */
|
|
48
46
|
filePath: string;
|
|
49
|
-
/** 导出名称,如 'default' 或具名导出 */
|
|
50
47
|
exportName: string;
|
|
51
|
-
/** 被消费的导入绝对路径 */
|
|
52
48
|
importPath: string;
|
|
53
|
-
/** 被消费的引用命名 */
|
|
54
49
|
importName: string;
|
|
55
|
-
/** 是否为类型 */
|
|
56
50
|
isType: boolean;
|
|
57
|
-
/** 是否位于 Node 模块中 */
|
|
58
51
|
isNodeModule: boolean;
|
|
59
52
|
}
|
|
60
53
|
//#endregion
|
|
@@ -99,7 +92,6 @@ declare class OiyoModApi {
|
|
|
99
92
|
private readonly config;
|
|
100
93
|
private readonly logger;
|
|
101
94
|
private readonly oiyoState;
|
|
102
|
-
/** 不含有 only 的 ApiScanTarget */
|
|
103
95
|
private sources;
|
|
104
96
|
apis: Map<string, ApiFile>;
|
|
105
97
|
constructor(config: OiyoConfig, deps: {
|
|
@@ -113,19 +105,7 @@ declare class OiyoModApi {
|
|
|
113
105
|
private recordApiSource;
|
|
114
106
|
private toApiSource;
|
|
115
107
|
private saveApi;
|
|
116
|
-
/**
|
|
117
|
-
* 直接提取
|
|
118
|
-
* - 1.必须是 Node 包
|
|
119
|
-
* - 2.必须指定某些值
|
|
120
|
-
*/
|
|
121
108
|
private directApi;
|
|
122
|
-
/**
|
|
123
|
-
* 扫描提取
|
|
124
|
-
* - 纯文件
|
|
125
|
-
* - 路径
|
|
126
|
-
* - node包
|
|
127
|
-
* - glob语法
|
|
128
|
-
*/
|
|
129
109
|
private scanApi;
|
|
130
110
|
scanApis(): Promise<(ApiFile[] | void[] | undefined)[]>;
|
|
131
111
|
private findApiSource;
|
|
@@ -142,37 +122,19 @@ declare class OiyoModApi {
|
|
|
142
122
|
//#endregion
|
|
143
123
|
//#region src/module/component/types.d.ts
|
|
144
124
|
interface ComponentFile {
|
|
145
|
-
/** 源文件在磁盘上的绝对路径 */
|
|
146
125
|
filePath: string;
|
|
147
|
-
/** 导出名称,如 'default' 或具名导出 */
|
|
148
126
|
exportName: string;
|
|
149
|
-
/** 被消费的引用命名 */
|
|
150
127
|
importName: string;
|
|
151
|
-
/** 被消费的导入绝对路径 */
|
|
152
128
|
importPath: string;
|
|
153
|
-
/** 是否位于 Node 模块中 */
|
|
154
129
|
isNodeModule: boolean;
|
|
155
130
|
}
|
|
156
131
|
interface ComponentScanSource extends ComponentScanTarget {
|
|
157
|
-
/**
|
|
158
|
-
* 扫描真实绝对路径
|
|
159
|
-
*/
|
|
160
132
|
dir: string;
|
|
161
|
-
/**
|
|
162
|
-
* 匹配文件模式 (支持glob语法)
|
|
163
|
-
*/
|
|
164
133
|
patterns?: string[];
|
|
165
|
-
/**
|
|
166
|
-
* 包的导出接口,用于针对 Node module
|
|
167
|
-
*/
|
|
168
134
|
isNodeModule: boolean;
|
|
169
135
|
}
|
|
170
136
|
//#endregion
|
|
171
137
|
//#region src/module/component/instance.d.ts
|
|
172
|
-
/**
|
|
173
|
-
* TODO:
|
|
174
|
-
* - 当 config 中含多个相同(范围匹配)的 target 时合并他们。
|
|
175
|
-
*/
|
|
176
138
|
declare class OiyoModComponent {
|
|
177
139
|
private readonly config;
|
|
178
140
|
private readonly logger;
|
|
@@ -192,17 +154,7 @@ declare class OiyoModComponent {
|
|
|
192
154
|
private recordComponentSource;
|
|
193
155
|
private toComponentSource;
|
|
194
156
|
private saveComponent;
|
|
195
|
-
/**
|
|
196
|
-
* 直接提取
|
|
197
|
-
* - 1.必须是 Node 包
|
|
198
|
-
* - 2.必须指定某些值
|
|
199
|
-
*/
|
|
200
157
|
private scanComponentByDirect;
|
|
201
|
-
/**
|
|
202
|
-
* 扫描提取
|
|
203
|
-
* - 1.可以是 路径、 Node 包
|
|
204
|
-
* - 2.不能指定某些值
|
|
205
|
-
*/
|
|
206
158
|
private scanComponentByDir;
|
|
207
159
|
private scanComponent;
|
|
208
160
|
scanComponents(): Promise<void>;
|
|
@@ -213,7 +165,7 @@ declare class OiyoModComponent {
|
|
|
213
165
|
generateDeclaration(): string;
|
|
214
166
|
writeDeclaration(): void;
|
|
215
167
|
applyComponents(source: string, file: string, options?: {
|
|
216
|
-
|
|
168
|
+
withApis: boolean;
|
|
217
169
|
}): {
|
|
218
170
|
code: string;
|
|
219
171
|
map: _$magic_string0.SourceMap;
|
|
@@ -221,15 +173,9 @@ declare class OiyoModComponent {
|
|
|
221
173
|
}
|
|
222
174
|
//#endregion
|
|
223
175
|
//#region src/module/layout/types.d.ts
|
|
224
|
-
/**
|
|
225
|
-
* 布局信息
|
|
226
|
-
*/
|
|
227
176
|
interface LayoutFile {
|
|
228
|
-
/** 布局应用名称 */
|
|
229
177
|
useName: string;
|
|
230
|
-
/** 布局组件名称 */
|
|
231
178
|
componentName: string;
|
|
232
|
-
/** 布局文件的绝对路径 */
|
|
233
179
|
filePath: string;
|
|
234
180
|
}
|
|
235
181
|
//#endregion
|
|
@@ -255,11 +201,6 @@ declare class OiyoModLayout {
|
|
|
255
201
|
exitLayout(file: string): boolean;
|
|
256
202
|
generateDeclaration(): string;
|
|
257
203
|
writeDeclaration(): boolean;
|
|
258
|
-
applyLayout(useName: string | false | undefined, template: string): {
|
|
259
|
-
template: string;
|
|
260
|
-
script: string;
|
|
261
|
-
imports: string[];
|
|
262
|
-
};
|
|
263
204
|
}
|
|
264
205
|
//#endregion
|
|
265
206
|
//#region src/module/layout/placeholder.d.ts
|
|
@@ -267,72 +208,40 @@ declare const OiyoLayout: _$vue.DefineComponent<{}, () => _$vue.VNode<_$vue.Rend
|
|
|
267
208
|
[key: string]: any;
|
|
268
209
|
}>[] | undefined, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
269
210
|
//#endregion
|
|
270
|
-
//#region src/module/
|
|
271
|
-
interface
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
script?: string;
|
|
276
|
-
/** 宏普通赋值的变量名,如 `const state = defineRootContext(...)` 中的 `state` */
|
|
277
|
-
variable?: string;
|
|
278
|
-
/** 宏解构赋值的属性列表,如 `const { count, user: u } = defineRootContext(...)` */
|
|
279
|
-
properties?: {
|
|
280
|
-
/** 本地变量名(解构后使用的名字) */local: string; /** 原始属性名(对象中的 key) */
|
|
281
|
-
original: string;
|
|
282
|
-
}[];
|
|
211
|
+
//#region src/module/shared/extractor/import.d.ts
|
|
212
|
+
interface ImportInfo {
|
|
213
|
+
importPath: string;
|
|
214
|
+
exportName: string;
|
|
215
|
+
importName: string;
|
|
283
216
|
}
|
|
284
217
|
//#endregion
|
|
285
218
|
//#region src/module/root/instance.d.ts
|
|
286
219
|
declare class OiyoModRoot {
|
|
287
220
|
readonly config: OiyoConfig;
|
|
288
|
-
/** 根视图模块 */
|
|
289
|
-
rootView: {
|
|
290
|
-
imports: string[];
|
|
291
|
-
template: string;
|
|
292
|
-
script: string;
|
|
293
|
-
};
|
|
294
|
-
/** 根虚拟模块 */
|
|
295
|
-
rootVM?: string;
|
|
296
|
-
/** 根宏命令结构 */
|
|
297
|
-
rootMarco?: ParsedRootMarco;
|
|
298
221
|
private readonly logger;
|
|
222
|
+
rootTemplateImports: Map<string, ImportInfo>;
|
|
223
|
+
rootTemplateContent: string;
|
|
224
|
+
rootTemplateScript: string;
|
|
225
|
+
rootMarcoImports: Map<string, ImportInfo>;
|
|
226
|
+
rootMarcoScript: string;
|
|
227
|
+
rootVM?: string;
|
|
299
228
|
constructor(config: OiyoConfig, deps: {
|
|
300
229
|
logger: Logger;
|
|
301
230
|
});
|
|
302
231
|
get srcDir(): string;
|
|
303
232
|
get rootPath(): string;
|
|
304
233
|
isRootPath(absPath: string): boolean;
|
|
305
|
-
parseRoot(source: string):
|
|
306
|
-
view: {
|
|
307
|
-
imports: string[];
|
|
308
|
-
template: string;
|
|
309
|
-
script: string;
|
|
310
|
-
};
|
|
311
|
-
marco: ParsedRootMarco | undefined;
|
|
312
|
-
};
|
|
234
|
+
parseRoot(source: string): boolean;
|
|
313
235
|
transformRoot(source: string): {
|
|
314
236
|
code: string;
|
|
315
|
-
|
|
237
|
+
map: _$magic_string0.SourceMap;
|
|
316
238
|
};
|
|
317
239
|
shouldRefreshView(code: string): boolean;
|
|
318
240
|
shouldRefreshVM: (code: string) => boolean;
|
|
319
|
-
applyRoot(pageSfc: SFCDescriptor): {
|
|
320
|
-
imports: string[];
|
|
321
|
-
script: string;
|
|
322
|
-
template: string;
|
|
323
|
-
};
|
|
324
241
|
}
|
|
325
242
|
//#endregion
|
|
326
243
|
//#region src/module/root/macro.d.ts
|
|
327
|
-
/**
|
|
328
|
-
* 根上下文工厂函数
|
|
329
|
-
*/
|
|
330
244
|
type RootContextFactory<T extends object> = () => T;
|
|
331
|
-
/**
|
|
332
|
-
* 定义根上下文
|
|
333
|
-
* @param factory 返回上下文对象的工厂函数
|
|
334
|
-
* @returns 上下文对象
|
|
335
|
-
*/
|
|
336
245
|
declare const defineRootContext: <T extends object>(factory: RootContextFactory<T>) => T;
|
|
337
246
|
//#endregion
|
|
338
247
|
//#region src/module/root/virtual-module.d.ts
|
|
@@ -340,44 +249,20 @@ declare const VIRTUAL_ROOT_CONTEXT_ID = "virtual:oiyo-root-context";
|
|
|
340
249
|
declare const RESOLVED_VIRTUAL_ROOT_CONTEXT_ID = "\0virtual:oiyo-root-context";
|
|
341
250
|
//#endregion
|
|
342
251
|
//#region src/module/route/types.d.ts
|
|
343
|
-
/**
|
|
344
|
-
* 可序列化的页面元信息值类型
|
|
345
|
-
* 用于静态提取和 pages.json 生成
|
|
346
|
-
*/
|
|
347
252
|
type PageMetaValue = string | number | boolean | null | PageMetaObject | PageMetaValue[];
|
|
348
|
-
/**
|
|
349
|
-
* 可序列化的页面元信息对象
|
|
350
|
-
*/
|
|
351
253
|
interface PageMetaObject {
|
|
352
254
|
[key: string]: PageMetaValue | undefined;
|
|
353
255
|
}
|
|
354
|
-
/**
|
|
355
|
-
* 页面元信息基础字段
|
|
356
|
-
*/
|
|
357
256
|
interface BasePageMeta {
|
|
358
|
-
/** 页面类型 */
|
|
359
257
|
type?: 'page' | 'home';
|
|
360
|
-
/** 使用的布局名称,false 表示不使用布局 */
|
|
361
258
|
layout?: string | false;
|
|
362
|
-
/** uni-app 页面样式配置 */
|
|
363
259
|
style?: GlobalStyle;
|
|
364
260
|
}
|
|
365
|
-
/**
|
|
366
|
-
* 已解析的页面元信息
|
|
367
|
-
* 用于编译期静态提取和 pages.json 生成
|
|
368
|
-
*/
|
|
369
261
|
interface ResolvedPageMeta extends BasePageMeta, PageMetaObject {}
|
|
370
|
-
/**
|
|
371
|
-
* 页面文件信息
|
|
372
|
-
*/
|
|
373
262
|
interface PageFile {
|
|
374
|
-
/** 页面路径(相对于 srcDir,不含扩展名) */
|
|
375
263
|
pagePath: string;
|
|
376
|
-
/** 页面文件的绝对路径 */
|
|
377
264
|
filePath: string;
|
|
378
|
-
/** 页面元信息 */
|
|
379
265
|
pageMeta: ResolvedPageMeta;
|
|
380
|
-
/** 所属包(main 或子包名称) */
|
|
381
266
|
pageBelong: string;
|
|
382
267
|
}
|
|
383
268
|
//#endregion
|
|
@@ -410,7 +295,6 @@ declare class OiyoModRoute {
|
|
|
410
295
|
private toPage;
|
|
411
296
|
private savePage;
|
|
412
297
|
private loadPagesConfig;
|
|
413
|
-
private loadPagesJson;
|
|
414
298
|
scanPages(): Promise<Map<string, PageFile>>;
|
|
415
299
|
isPage(file: string): boolean;
|
|
416
300
|
enterPage(file: string): boolean;
|
|
@@ -422,25 +306,20 @@ declare class OiyoModRoute {
|
|
|
422
306
|
watchPagesConfig(onUpdateCallback?: () => void | Promise<void>): Promise<void>;
|
|
423
307
|
unwatchPagesConfig(): Promise<void>;
|
|
424
308
|
transformPage(source: string, file: string): Promise<{
|
|
309
|
+
code: string;
|
|
310
|
+
map: _$magic_string0.SourceMap;
|
|
311
|
+
sourceMap?: undefined;
|
|
312
|
+
} | {
|
|
425
313
|
code: string;
|
|
426
314
|
sourceMap: _$magic_string0.SourceMap;
|
|
315
|
+
map?: undefined;
|
|
427
316
|
}>;
|
|
428
317
|
}
|
|
429
318
|
//#endregion
|
|
430
319
|
//#region src/module/route/macro.d.ts
|
|
431
|
-
/**
|
|
432
|
-
* 页面元信息
|
|
433
|
-
* 用户在 definePageMeta() 中使用的类型
|
|
434
|
-
* 支持通过 declare module '@skiyee/oiyo' 进行扩展
|
|
435
|
-
*/
|
|
436
320
|
interface PageMeta extends BasePageMeta {
|
|
437
|
-
/** 其他自定义字段 */
|
|
438
321
|
[key: string]: unknown;
|
|
439
322
|
}
|
|
440
|
-
/**
|
|
441
|
-
* 定义页面元信息
|
|
442
|
-
* @param meta 页面元信息配置
|
|
443
|
-
*/
|
|
444
323
|
declare const definePageMeta: (meta: PageMeta) => void;
|
|
445
324
|
//#endregion
|
|
446
325
|
//#region src/module/route/placeholder.d.ts
|