@uni-helper/vite-plugin-uni-pages 0.2.2 → 0.2.3

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/client.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  declare module "virtual:uni-pages" {
2
- export const pages: {
3
- path: string;
4
- type: "home" | "page";
5
- style: any;
6
- }[];
2
+ import { PageMetaDatum } from "./src/types";
3
+ import { SubPackage } from "./src/config/types/index";
4
+ export const pages: PageMetaDatum[];
5
+ export const subPackages: SubPackage[];
7
6
  }
package/dist/index.cjs CHANGED
@@ -421,12 +421,17 @@ class PageContext {
421
421
  writeFileSync(this.resolvedPagesJSONPath, pagesJson);
422
422
  this.options.onAfterWriteFile(this);
423
423
  }
424
- async virtualModule() {
425
- return `export const pages = ${this.resolveRoutes()};`;
424
+ virtualModule() {
425
+ const pages = `export const pages = ${this.resolveRoutes()};`;
426
+ const subPackages = `export const subPackages = ${this.resolveSubRoutes()};`;
427
+ return [pages, subPackages].join("\n");
426
428
  }
427
429
  resolveRoutes() {
428
430
  return JSON.stringify(this.pageMetaData, null, 2);
429
431
  }
432
+ resolveSubRoutes() {
433
+ return JSON.stringify(this.subPageMetaData, null, 2);
434
+ }
430
435
  }
431
436
  function getPagePaths(dir, options) {
432
437
  const pagesDirPath = slash(path__default.resolve(options.root, dir));
package/dist/index.d.ts CHANGED
@@ -661,8 +661,9 @@ declare class PageContext {
661
661
  mergePageMetaData(): Promise<void>;
662
662
  mergeSubPageMetaData(): Promise<void>;
663
663
  updatePagesJSON(): Promise<void>;
664
- virtualModule(): Promise<string>;
664
+ virtualModule(): string;
665
665
  resolveRoutes(): string;
666
+ resolveSubRoutes(): string;
666
667
  }
667
668
 
668
669
  declare function invalidatePagesModule(server: ViteDevServer): void;
package/dist/index.mjs CHANGED
@@ -407,12 +407,17 @@ class PageContext {
407
407
  writeFileSync(this.resolvedPagesJSONPath, pagesJson);
408
408
  this.options.onAfterWriteFile(this);
409
409
  }
410
- async virtualModule() {
411
- return `export const pages = ${this.resolveRoutes()};`;
410
+ virtualModule() {
411
+ const pages = `export const pages = ${this.resolveRoutes()};`;
412
+ const subPackages = `export const subPackages = ${this.resolveSubRoutes()};`;
413
+ return [pages, subPackages].join("\n");
412
414
  }
413
415
  resolveRoutes() {
414
416
  return JSON.stringify(this.pageMetaData, null, 2);
415
417
  }
418
+ resolveSubRoutes() {
419
+ return JSON.stringify(this.subPageMetaData, null, 2);
420
+ }
416
421
  }
417
422
  function getPagePaths(dir, options) {
418
423
  const pagesDirPath = slash(path.resolve(options.root, dir));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uni-helper/vite-plugin-uni-pages",
3
3
  "type": "module",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "description": "File system based routing for uni-app applications using Vite",
6
6
  "author": "KeJun",
7
7
  "license": "MIT",