@uni-helper/vite-plugin-uni-pages 0.3.20 → 0.3.22
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 +2 -6
- package/dist/index.cjs +8 -4
- package/dist/index.mjs +8 -4
- package/global.d.ts +5 -0
- package/package.json +2 -1
package/client.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference path="./global.d.ts" />
|
|
2
|
+
|
|
1
3
|
declare module 'virtual:uni-pages' {
|
|
2
4
|
import type { SubPackage } from './src/config/types/index'
|
|
3
5
|
import type { PageMetaDatum } from './src/types'
|
|
@@ -5,9 +7,3 @@ declare module 'virtual:uni-pages' {
|
|
|
5
7
|
export const pages: PageMetaDatum[]
|
|
6
8
|
export const subPackages: SubPackage[]
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
declare global {
|
|
10
|
-
const definePage: import('.').DefinePage
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export {}
|
package/dist/index.cjs
CHANGED
|
@@ -319,18 +319,18 @@ async function writeFileWithLock(path, content, retry = 3) {
|
|
|
319
319
|
debug.error(`${path} \u83B7\u53D6\u6587\u4EF6\u9501\u5931\u8D25\uFF0C\u5199\u5165\u5931\u8D25`);
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
|
-
let
|
|
322
|
+
let release;
|
|
323
323
|
try {
|
|
324
324
|
try {
|
|
325
|
-
|
|
325
|
+
release = await lockfile__default.lock(path, { realpath: false });
|
|
326
326
|
} catch {
|
|
327
327
|
await sleep(500);
|
|
328
328
|
return writeFileWithLock(path, content, retry - 1);
|
|
329
329
|
}
|
|
330
330
|
await fs__default.promises.writeFile(path, content, { encoding: "utf-8" });
|
|
331
331
|
} finally {
|
|
332
|
-
if (
|
|
333
|
-
await
|
|
332
|
+
if (release) {
|
|
333
|
+
await release();
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
}
|
|
@@ -809,6 +809,9 @@ class PageContext {
|
|
|
809
809
|
return result;
|
|
810
810
|
}
|
|
811
811
|
async mergePageMetaData() {
|
|
812
|
+
const subPageAbsolutePaths = Array.from(this.subPages.values()).flatMap((v) => Array.from(v.keys()));
|
|
813
|
+
for (const subPageAbsolutePath of subPageAbsolutePaths)
|
|
814
|
+
this.pages.delete(subPageAbsolutePath);
|
|
812
815
|
const pageMetaData = await this.parsePages(this.pages, "main", this.pagesGlobConfig?.pages);
|
|
813
816
|
this.pageMetaData = pageMetaData;
|
|
814
817
|
debug.pages(this.pageMetaData);
|
|
@@ -1062,6 +1065,7 @@ function mergePlatformItems(source, currentPlatform, items, uniqueKeyName) {
|
|
|
1062
1065
|
const equalObj = existing.find((val) => val.itemStr === newItemStr);
|
|
1063
1066
|
if (equalObj) {
|
|
1064
1067
|
equalObj.platforms.push(currentPlatform);
|
|
1068
|
+
equalObj.platforms.sort();
|
|
1065
1069
|
equalObj.platformStr = equalObj.platforms.join(" || ");
|
|
1066
1070
|
} else {
|
|
1067
1071
|
existing.push({
|
package/dist/index.mjs
CHANGED
|
@@ -284,18 +284,18 @@ async function writeFileWithLock(path, content, retry = 3) {
|
|
|
284
284
|
debug.error(`${path} \u83B7\u53D6\u6587\u4EF6\u9501\u5931\u8D25\uFF0C\u5199\u5165\u5931\u8D25`);
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
-
let
|
|
287
|
+
let release;
|
|
288
288
|
try {
|
|
289
289
|
try {
|
|
290
|
-
|
|
290
|
+
release = await lockfile.lock(path, { realpath: false });
|
|
291
291
|
} catch {
|
|
292
292
|
await sleep(500);
|
|
293
293
|
return writeFileWithLock(path, content, retry - 1);
|
|
294
294
|
}
|
|
295
295
|
await fs.promises.writeFile(path, content, { encoding: "utf-8" });
|
|
296
296
|
} finally {
|
|
297
|
-
if (
|
|
298
|
-
await
|
|
297
|
+
if (release) {
|
|
298
|
+
await release();
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
}
|
|
@@ -774,6 +774,9 @@ class PageContext {
|
|
|
774
774
|
return result;
|
|
775
775
|
}
|
|
776
776
|
async mergePageMetaData() {
|
|
777
|
+
const subPageAbsolutePaths = Array.from(this.subPages.values()).flatMap((v) => Array.from(v.keys()));
|
|
778
|
+
for (const subPageAbsolutePath of subPageAbsolutePaths)
|
|
779
|
+
this.pages.delete(subPageAbsolutePath);
|
|
777
780
|
const pageMetaData = await this.parsePages(this.pages, "main", this.pagesGlobConfig?.pages);
|
|
778
781
|
this.pageMetaData = pageMetaData;
|
|
779
782
|
debug.pages(this.pageMetaData);
|
|
@@ -1027,6 +1030,7 @@ function mergePlatformItems(source, currentPlatform, items, uniqueKeyName) {
|
|
|
1027
1030
|
const equalObj = existing.find((val) => val.itemStr === newItemStr);
|
|
1028
1031
|
if (equalObj) {
|
|
1029
1032
|
equalObj.platforms.push(currentPlatform);
|
|
1033
|
+
equalObj.platforms.sort();
|
|
1030
1034
|
equalObj.platformStr = equalObj.platforms.join(" || ");
|
|
1031
1035
|
} else {
|
|
1032
1036
|
existing.push({
|
package/global.d.ts
ADDED
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.3.
|
|
4
|
+
"version": "0.3.22",
|
|
5
5
|
"description": "File system based routing for uni-app applications using Vite",
|
|
6
6
|
"author": "KeJun",
|
|
7
7
|
"maintainers": [
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"files": [
|
|
46
46
|
"client.d.ts",
|
|
47
47
|
"dist",
|
|
48
|
+
"global.d.ts",
|
|
48
49
|
"index.d.ts"
|
|
49
50
|
],
|
|
50
51
|
"peerDependencies": {
|