@oiyo/core 0.3.0-beta.2 → 0.3.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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @oiyo/core v0.3.0-beta.2
2
+ * @oiyo/core v0.3.0
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
@@ -255,11 +254,6 @@ declare class OiyoModLayout {
255
254
  exitLayout(file: string): boolean;
256
255
  generateDeclaration(): string;
257
256
  writeDeclaration(): boolean;
258
- applyLayout(useName: string | false | undefined, template: string): {
259
- template: string;
260
- script: string;
261
- imports: string[];
262
- };
263
257
  }
264
258
  //#endregion
265
259
  //#region src/module/layout/placeholder.d.ts
@@ -267,60 +261,37 @@ declare const OiyoLayout: _$vue.DefineComponent<{}, () => _$vue.VNode<_$vue.Rend
267
261
  [key: string]: any;
268
262
  }>[] | undefined, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{}>>, {}, {}>;
269
263
  //#endregion
270
- //#region src/module/root/parse.d.ts
271
- interface ParsedRootMarco {
272
- /** 宏引用模块 */
273
- imports?: string[];
274
- /** 宏工厂代码 (()=>{xxx}) */
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
- }[];
264
+ //#region src/module/shared/extractor/import.d.ts
265
+ interface ImportInfo {
266
+ importPath: string;
267
+ exportName: string;
268
+ importName: string;
283
269
  }
284
270
  //#endregion
285
271
  //#region src/module/root/instance.d.ts
286
272
  declare class OiyoModRoot {
287
273
  readonly config: OiyoConfig;
288
- /** 根视图模块 */
289
- rootView: {
290
- imports: string[];
291
- template: string;
292
- script: string;
293
- };
274
+ private readonly logger;
275
+ rootTemplateImports: Map<string, ImportInfo>;
276
+ rootTemplateContent: string;
277
+ rootTemplateScript: string;
278
+ rootMarcoImports: Map<string, ImportInfo>;
279
+ rootMarcoScript: string;
294
280
  /** 根虚拟模块 */
295
281
  rootVM?: string;
296
- /** 根宏命令结构 */
297
- rootMarco?: ParsedRootMarco;
298
- private readonly logger;
299
282
  constructor(config: OiyoConfig, deps: {
300
283
  logger: Logger;
301
284
  });
302
285
  get srcDir(): string;
303
286
  get rootPath(): string;
304
287
  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
- };
288
+ parseRoot(source: string): boolean;
313
289
  transformRoot(source: string): {
314
290
  code: string;
315
- sourceMap: _$magic_string0.SourceMap;
291
+ map: _$magic_string0.SourceMap;
316
292
  };
317
293
  shouldRefreshView(code: string): boolean;
318
294
  shouldRefreshVM: (code: string) => boolean;
319
- applyRoot(pageSfc: SFCDescriptor): {
320
- imports: string[];
321
- script: string;
322
- template: string;
323
- };
324
295
  }
325
296
  //#endregion
326
297
  //#region src/module/root/macro.d.ts
@@ -410,7 +381,6 @@ declare class OiyoModRoute {
410
381
  private toPage;
411
382
  private savePage;
412
383
  private loadPagesConfig;
413
- private loadPagesJson;
414
384
  scanPages(): Promise<Map<string, PageFile>>;
415
385
  isPage(file: string): boolean;
416
386
  enterPage(file: string): boolean;
@@ -422,8 +392,13 @@ declare class OiyoModRoute {
422
392
  watchPagesConfig(onUpdateCallback?: () => void | Promise<void>): Promise<void>;
423
393
  unwatchPagesConfig(): Promise<void>;
424
394
  transformPage(source: string, file: string): Promise<{
395
+ code: string;
396
+ map: _$magic_string0.SourceMap;
397
+ sourceMap?: undefined;
398
+ } | {
425
399
  code: string;
426
400
  sourceMap: _$magic_string0.SourceMap;
401
+ map?: undefined;
427
402
  }>;
428
403
  }
429
404
  //#endregion
package/dist/index.d.mts CHANGED
@@ -1,11 +1,10 @@
1
1
  /**
2
- * @oiyo/core v0.3.0-beta.2
2
+ * @oiyo/core v0.3.0
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";
@@ -255,11 +254,6 @@ declare class OiyoModLayout {
255
254
  exitLayout(file: string): boolean;
256
255
  generateDeclaration(): string;
257
256
  writeDeclaration(): boolean;
258
- applyLayout(useName: string | false | undefined, template: string): {
259
- template: string;
260
- script: string;
261
- imports: string[];
262
- };
263
257
  }
264
258
  //#endregion
265
259
  //#region src/module/layout/placeholder.d.ts
@@ -267,60 +261,37 @@ declare const OiyoLayout: _$vue.DefineComponent<{}, () => _$vue.VNode<_$vue.Rend
267
261
  [key: string]: any;
268
262
  }>[] | undefined, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{}>>, {}, {}>;
269
263
  //#endregion
270
- //#region src/module/root/parse.d.ts
271
- interface ParsedRootMarco {
272
- /** 宏引用模块 */
273
- imports?: string[];
274
- /** 宏工厂代码 (()=>{xxx}) */
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
- }[];
264
+ //#region src/module/shared/extractor/import.d.ts
265
+ interface ImportInfo {
266
+ importPath: string;
267
+ exportName: string;
268
+ importName: string;
283
269
  }
284
270
  //#endregion
285
271
  //#region src/module/root/instance.d.ts
286
272
  declare class OiyoModRoot {
287
273
  readonly config: OiyoConfig;
288
- /** 根视图模块 */
289
- rootView: {
290
- imports: string[];
291
- template: string;
292
- script: string;
293
- };
274
+ private readonly logger;
275
+ rootTemplateImports: Map<string, ImportInfo>;
276
+ rootTemplateContent: string;
277
+ rootTemplateScript: string;
278
+ rootMarcoImports: Map<string, ImportInfo>;
279
+ rootMarcoScript: string;
294
280
  /** 根虚拟模块 */
295
281
  rootVM?: string;
296
- /** 根宏命令结构 */
297
- rootMarco?: ParsedRootMarco;
298
- private readonly logger;
299
282
  constructor(config: OiyoConfig, deps: {
300
283
  logger: Logger;
301
284
  });
302
285
  get srcDir(): string;
303
286
  get rootPath(): string;
304
287
  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
- };
288
+ parseRoot(source: string): boolean;
313
289
  transformRoot(source: string): {
314
290
  code: string;
315
- sourceMap: _$magic_string0.SourceMap;
291
+ map: _$magic_string0.SourceMap;
316
292
  };
317
293
  shouldRefreshView(code: string): boolean;
318
294
  shouldRefreshVM: (code: string) => boolean;
319
- applyRoot(pageSfc: SFCDescriptor): {
320
- imports: string[];
321
- script: string;
322
- template: string;
323
- };
324
295
  }
325
296
  //#endregion
326
297
  //#region src/module/root/macro.d.ts
@@ -410,7 +381,6 @@ declare class OiyoModRoute {
410
381
  private toPage;
411
382
  private savePage;
412
383
  private loadPagesConfig;
413
- private loadPagesJson;
414
384
  scanPages(): Promise<Map<string, PageFile>>;
415
385
  isPage(file: string): boolean;
416
386
  enterPage(file: string): boolean;
@@ -422,8 +392,13 @@ declare class OiyoModRoute {
422
392
  watchPagesConfig(onUpdateCallback?: () => void | Promise<void>): Promise<void>;
423
393
  unwatchPagesConfig(): Promise<void>;
424
394
  transformPage(source: string, file: string): Promise<{
395
+ code: string;
396
+ map: _$magic_string0.SourceMap;
397
+ sourceMap?: undefined;
398
+ } | {
425
399
  code: string;
426
400
  sourceMap: _$magic_string0.SourceMap;
401
+ map?: undefined;
427
402
  }>;
428
403
  }
429
404
  //#endregion