@uni-helper/vite-plugin-uni-pages 0.1.6 → 0.1.7
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 +9 -6
- package/dist/index.mjs +6 -4
- package/package.json +7 -8
package/dist/index.cjs
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const path = require('path');
|
|
5
|
+
const path$1 = require('path');
|
|
6
6
|
const child_process = require('child_process');
|
|
7
7
|
const vite = require('vite');
|
|
8
8
|
const MagicString = require('magic-string');
|
|
9
9
|
const chokidar = require('chokidar');
|
|
10
|
+
const path = require('node:path');
|
|
10
11
|
const unconfig = require('unconfig');
|
|
12
|
+
const uniEnv = require('@uni-helper/uni-env');
|
|
11
13
|
const Debug = require('debug');
|
|
12
|
-
const
|
|
14
|
+
const lodashUnified = require('lodash-unified');
|
|
13
15
|
const fg = require('fast-glob');
|
|
14
16
|
const fs = require('fs');
|
|
15
17
|
const JSON5 = require('json5');
|
|
@@ -18,9 +20,10 @@ const compilerSfc = require('@vue/compiler-sfc');
|
|
|
18
20
|
|
|
19
21
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
20
22
|
|
|
21
|
-
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
23
|
+
const path__default$1 = /*#__PURE__*/_interopDefaultCompat(path$1);
|
|
22
24
|
const MagicString__default = /*#__PURE__*/_interopDefaultCompat(MagicString);
|
|
23
25
|
const chokidar__default = /*#__PURE__*/_interopDefaultCompat(chokidar);
|
|
26
|
+
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
24
27
|
const Debug__default = /*#__PURE__*/_interopDefaultCompat(Debug);
|
|
25
28
|
const fg__default = /*#__PURE__*/_interopDefaultCompat(fg);
|
|
26
29
|
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
@@ -63,7 +66,7 @@ function isConfigFile(path) {
|
|
|
63
66
|
return path.includes("pages.config");
|
|
64
67
|
}
|
|
65
68
|
function mergePageMetaDataArray(pageMetaData) {
|
|
66
|
-
const pageMetaDataObj =
|
|
69
|
+
const pageMetaDataObj = lodashUnified.groupBy(pageMetaData, "path");
|
|
67
70
|
const result = [];
|
|
68
71
|
for (const path in pageMetaDataObj) {
|
|
69
72
|
const _pageMetaData = pageMetaDataObj[path];
|
|
@@ -274,7 +277,7 @@ class PageContext {
|
|
|
274
277
|
this.setupWatcher(server.watcher);
|
|
275
278
|
}
|
|
276
279
|
async setupWatcher(watcher) {
|
|
277
|
-
if (
|
|
280
|
+
if (!uniEnv.isH5) {
|
|
278
281
|
const configs = await getPagesConfigSourcePaths();
|
|
279
282
|
watcher.add(configs);
|
|
280
283
|
}
|
|
@@ -383,7 +386,7 @@ async function restart() {
|
|
|
383
386
|
}
|
|
384
387
|
const VitePluginUniPages = (userOptions = {}) => {
|
|
385
388
|
let ctx;
|
|
386
|
-
const resolvedPagesJSONPath = path__default.join(
|
|
389
|
+
const resolvedPagesJSONPath = path__default$1.join(
|
|
387
390
|
process.cwd(),
|
|
388
391
|
userOptions.outDir ?? "src",
|
|
389
392
|
OUTPUT_NAME
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import path from 'path';
|
|
1
|
+
import path$1 from 'path';
|
|
2
2
|
import { spawn } from 'child_process';
|
|
3
3
|
import { normalizePath, createLogger } from 'vite';
|
|
4
4
|
import MagicString from 'magic-string';
|
|
5
5
|
import chokidar from 'chokidar';
|
|
6
|
+
import path from 'node:path';
|
|
6
7
|
import { loadConfig } from 'unconfig';
|
|
8
|
+
import { isH5 } from '@uni-helper/uni-env';
|
|
7
9
|
import Debug from 'debug';
|
|
8
|
-
import { groupBy } from 'lodash';
|
|
10
|
+
import { groupBy } from 'lodash-unified';
|
|
9
11
|
import fg from 'fast-glob';
|
|
10
12
|
import fs from 'fs';
|
|
11
13
|
import JSON5 from 'json5';
|
|
@@ -260,7 +262,7 @@ class PageContext {
|
|
|
260
262
|
this.setupWatcher(server.watcher);
|
|
261
263
|
}
|
|
262
264
|
async setupWatcher(watcher) {
|
|
263
|
-
if (
|
|
265
|
+
if (!isH5) {
|
|
264
266
|
const configs = await getPagesConfigSourcePaths();
|
|
265
267
|
watcher.add(configs);
|
|
266
268
|
}
|
|
@@ -369,7 +371,7 @@ async function restart() {
|
|
|
369
371
|
}
|
|
370
372
|
const VitePluginUniPages = (userOptions = {}) => {
|
|
371
373
|
let ctx;
|
|
372
|
-
const resolvedPagesJSONPath = path.join(
|
|
374
|
+
const resolvedPagesJSONPath = path$1.join(
|
|
373
375
|
process.cwd(),
|
|
374
376
|
userOptions.outDir ?? "src",
|
|
375
377
|
OUTPUT_NAME
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uni-helper/vite-plugin-uni-pages",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"packageManager": "pnpm@7.16.1",
|
|
4
|
+
"version": "0.1.7",
|
|
6
5
|
"description": "File system based routing for uni-app applications using Vite",
|
|
7
6
|
"author": "KeJun",
|
|
8
7
|
"license": "MIT",
|
|
@@ -32,22 +31,22 @@
|
|
|
32
31
|
"client.d.ts"
|
|
33
32
|
],
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@
|
|
34
|
+
"@uni-helper/uni-env": "^0.0.2",
|
|
35
|
+
"@vue/compiler-sfc": "^3.2.47",
|
|
36
36
|
"chokidar": "^3.5.3",
|
|
37
37
|
"debug": "^4.3.4",
|
|
38
38
|
"fast-glob": "^3.2.12",
|
|
39
39
|
"json5": "^2.2.3",
|
|
40
|
-
"lodash": "^
|
|
41
|
-
"magic-string": "^0.
|
|
40
|
+
"lodash-unified": "^1.0.3",
|
|
41
|
+
"magic-string": "^0.30.0",
|
|
42
42
|
"unconfig": "^0.3.7",
|
|
43
43
|
"yaml": "^2.2.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@antfu/utils": "^0.7.2",
|
|
47
47
|
"@types/debug": "^4.1.7",
|
|
48
|
-
"@types/
|
|
49
|
-
"
|
|
50
|
-
"vite": "^4.0.3"
|
|
48
|
+
"@types/node": "^18.15.11",
|
|
49
|
+
"vite": "^4.2.1"
|
|
51
50
|
},
|
|
52
51
|
"scripts": {
|
|
53
52
|
"build": "unbuild",
|