@uni-helper/vite-plugin-uni-pages 0.2.19 → 0.2.21

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 CHANGED
@@ -244,7 +244,7 @@ function resolveOptions(userOptions, viteRoot = process__default.cwd()) {
244
244
  onAfterWriteFile = () => {
245
245
  }
246
246
  } = userOptions;
247
- const root = viteRoot || slash(process__default.cwd());
247
+ const root = viteRoot || slash(process__default.env.VITE_ROOT_DIR) || slash(process__default.cwd());
248
248
  const resolvedDirs = resolvePageDirs(dir, root, exclude);
249
249
  const resolvedSubDirs = subPackages.map((dir2) => slash(dir2));
250
250
  const resolvedHomePage = typeof homePage === "string" ? [homePage] : homePage;
@@ -487,7 +487,7 @@ class PageContext {
487
487
  const subPackages = this.pagesGlobConfig?.subPackages || [];
488
488
  for (const [dir, pages] of Object.entries(this.subPagesPath)) {
489
489
  const basePath = slash(path__default.join(this.options.root, this.options.outDir));
490
- const root = slash(path__default.relative(basePath, dir));
490
+ const root = slash(path__default.relative(basePath, path__default.join(this.options.root, dir)));
491
491
  const globPackage = subPackages?.find((v) => v.root === root);
492
492
  subPageMaps[root] = await this.parsePages(pages, "sub", globPackage?.pages);
493
493
  subPageMaps[root] = subPageMaps[root].map((page) => ({ ...page, path: slash(path__default.relative(root, page.path)) }));
@@ -579,7 +579,7 @@ function defineUniPages(config) {
579
579
  async function restart() {
580
580
  return new Promise((resolve) => {
581
581
  const build = node_child_process.spawn(process__default.argv.shift(), process__default.argv, {
582
- cwd: process__default.cwd(),
582
+ cwd: process__default.env.VITE_ROOT_DIR,
583
583
  detached: true,
584
584
  env: process__default.env
585
585
  });
@@ -593,7 +593,7 @@ async function restart() {
593
593
  function VitePluginUniPages(userOptions = {}) {
594
594
  let ctx;
595
595
  const resolvedPagesJSONPath = path__default.join(
596
- process__default.cwd(),
596
+ process__default.env.VITE_ROOT_DIR,
597
597
  userOptions.outDir ?? "src",
598
598
  OUTPUT_NAME
599
599
  );
package/dist/index.mjs CHANGED
@@ -229,7 +229,7 @@ function resolveOptions(userOptions, viteRoot = process.cwd()) {
229
229
  onAfterWriteFile = () => {
230
230
  }
231
231
  } = userOptions;
232
- const root = viteRoot || slash(process.cwd());
232
+ const root = viteRoot || slash(process.env.VITE_ROOT_DIR) || slash(process.cwd());
233
233
  const resolvedDirs = resolvePageDirs(dir, root, exclude);
234
234
  const resolvedSubDirs = subPackages.map((dir2) => slash(dir2));
235
235
  const resolvedHomePage = typeof homePage === "string" ? [homePage] : homePage;
@@ -472,7 +472,7 @@ class PageContext {
472
472
  const subPackages = this.pagesGlobConfig?.subPackages || [];
473
473
  for (const [dir, pages] of Object.entries(this.subPagesPath)) {
474
474
  const basePath = slash(path.join(this.options.root, this.options.outDir));
475
- const root = slash(path.relative(basePath, dir));
475
+ const root = slash(path.relative(basePath, path.join(this.options.root, dir)));
476
476
  const globPackage = subPackages?.find((v) => v.root === root);
477
477
  subPageMaps[root] = await this.parsePages(pages, "sub", globPackage?.pages);
478
478
  subPageMaps[root] = subPageMaps[root].map((page) => ({ ...page, path: slash(path.relative(root, page.path)) }));
@@ -564,7 +564,7 @@ function defineUniPages(config) {
564
564
  async function restart() {
565
565
  return new Promise((resolve) => {
566
566
  const build = spawn(process.argv.shift(), process.argv, {
567
- cwd: process.cwd(),
567
+ cwd: process.env.VITE_ROOT_DIR,
568
568
  detached: true,
569
569
  env: process.env
570
570
  });
@@ -578,7 +578,7 @@ async function restart() {
578
578
  function VitePluginUniPages(userOptions = {}) {
579
579
  let ctx;
580
580
  const resolvedPagesJSONPath = path.join(
581
- process.cwd(),
581
+ process.env.VITE_ROOT_DIR,
582
582
  userOptions.outDir ?? "src",
583
583
  OUTPUT_NAME
584
584
  );
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.19",
4
+ "version": "0.2.21",
5
5
  "description": "File system based routing for uni-app applications using Vite",
6
6
  "author": "KeJun",
7
7
  "license": "MIT",