@uni-helper/vite-plugin-uni-pages 0.1.0 → 0.1.2
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 +4 -3
- package/dist/index.mjs +3 -2
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -5,9 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const MagicString = require('magic-string');
|
|
7
7
|
const chokidar = require('chokidar');
|
|
8
|
+
const vite = require('vite');
|
|
8
9
|
const unconfig = require('unconfig');
|
|
9
10
|
const Debug = require('debug');
|
|
10
|
-
const
|
|
11
|
+
const lodash = require('lodash');
|
|
11
12
|
const fg = require('fast-glob');
|
|
12
13
|
const fs = require('fs');
|
|
13
14
|
const JSON5 = require('json5');
|
|
@@ -51,7 +52,7 @@ function isConfigFile(path) {
|
|
|
51
52
|
return path.includes("pages.config");
|
|
52
53
|
}
|
|
53
54
|
function mergePageMetaDataArray(pageMetaData) {
|
|
54
|
-
const pageMetaDataObj =
|
|
55
|
+
const pageMetaDataObj = lodash.groupBy(pageMetaData, "path");
|
|
55
56
|
const result = [];
|
|
56
57
|
for (const path in pageMetaDataObj) {
|
|
57
58
|
const _pageMetaData = pageMetaDataObj[path];
|
|
@@ -277,7 +278,7 @@ class PageContext {
|
|
|
277
278
|
const { relativePath, absolutePath } = page;
|
|
278
279
|
const routeBlock = await getRouteBlock(absolutePath, this.options);
|
|
279
280
|
const relativePathWithFileName = relativePath.replace(path.extname(relativePath), "");
|
|
280
|
-
const pageMetaDatum = { path: relativePathWithFileName, type: "page" };
|
|
281
|
+
const pageMetaDatum = { path: vite.normalizePath(relativePathWithFileName), type: "page" };
|
|
281
282
|
if (routeBlock)
|
|
282
283
|
Object.assign(pageMetaDatum, routeBlock);
|
|
283
284
|
return pageMetaDatum;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import MagicString from 'magic-string';
|
|
3
3
|
import chokidar from 'chokidar';
|
|
4
|
+
import { normalizePath } from 'vite';
|
|
4
5
|
import { loadConfig } from 'unconfig';
|
|
5
6
|
import Debug from 'debug';
|
|
6
|
-
import { groupBy } from 'lodash
|
|
7
|
+
import { groupBy } from 'lodash';
|
|
7
8
|
import fg from 'fast-glob';
|
|
8
9
|
import fs from 'fs';
|
|
9
10
|
import JSON5 from 'json5';
|
|
@@ -273,7 +274,7 @@ class PageContext {
|
|
|
273
274
|
const { relativePath, absolutePath } = page;
|
|
274
275
|
const routeBlock = await getRouteBlock(absolutePath, this.options);
|
|
275
276
|
const relativePathWithFileName = relativePath.replace(path.extname(relativePath), "");
|
|
276
|
-
const pageMetaDatum = { path: relativePathWithFileName, type: "page" };
|
|
277
|
+
const pageMetaDatum = { path: normalizePath(relativePathWithFileName), type: "page" };
|
|
277
278
|
if (routeBlock)
|
|
278
279
|
Object.assign(pageMetaDatum, routeBlock);
|
|
279
280
|
return pageMetaDatum;
|
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.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"packageManager": "pnpm@7.16.1",
|
|
6
6
|
"description": "File system based routing for uni-app applications using Vite",
|
|
7
7
|
"author": "KeJun",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"require": "./dist/index.cjs",
|
|
21
|
-
"import": "./dist/index.
|
|
21
|
+
"import": "./dist/index.mjs"
|
|
22
22
|
},
|
|
23
23
|
"./client": {
|
|
24
24
|
"types": "./client.d.ts"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"main": "./dist/index.mjs",
|
|
28
|
-
"module": "./dist/index.
|
|
28
|
+
"module": "./dist/index.cjs",
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"files": [
|
|
31
31
|
"dist",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"debug": "^4.3.4",
|
|
38
38
|
"fast-glob": "^3.2.12",
|
|
39
39
|
"json5": "^2.2.3",
|
|
40
|
-
"lodash
|
|
40
|
+
"lodash": "^4.17.21",
|
|
41
41
|
"magic-string": "^0.27.0",
|
|
42
42
|
"unconfig": "^0.3.7",
|
|
43
43
|
"yaml": "^2.2.1"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@antfu/utils": "^0.7.2",
|
|
47
47
|
"@types/debug": "^4.1.7",
|
|
48
|
-
"@types/lodash
|
|
48
|
+
"@types/lodash": "^4.14.191",
|
|
49
49
|
"@types/node": "^18.11.18",
|
|
50
50
|
"vite": "^4.0.3"
|
|
51
51
|
},
|