vite-plugin-generoutes 0.0.18 → 0.1.0
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.d.ts +1 -1
- package/dist/index.js +6 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,10 +6,13 @@ import { parse } from "@vue/compiler-sfc";
|
|
|
6
6
|
import { debounce, slash } from "@antfu/utils";
|
|
7
7
|
import chokidar from "chokidar";
|
|
8
8
|
import prettier from "prettier";
|
|
9
|
-
|
|
9
|
+
var defaultOptions = {
|
|
10
|
+
routesFolder: "src/router/generoutes/"
|
|
11
|
+
};
|
|
12
|
+
function VitePluginGeneroutes(options = defaultOptions) {
|
|
10
13
|
const defineOptionsCache = /* @__PURE__ */ new Map();
|
|
11
14
|
let rootDir;
|
|
12
|
-
let routesFolder = "src/router/generoutes/";
|
|
15
|
+
let routesFolder = options.routesFolder ?? "src/router/generoutes/";
|
|
13
16
|
async function writerRoutesFile() {
|
|
14
17
|
const { routes } = generateMenusAndRoutes();
|
|
15
18
|
let routesStr = `
|
|
@@ -74,7 +77,7 @@ function VitePluginGeneroutes(options = {}) {
|
|
|
74
77
|
routesFolder = slash(path.resolve(rootDir, routesFolder));
|
|
75
78
|
await fs.ensureDir(routesFolder);
|
|
76
79
|
await writerRoutesFile();
|
|
77
|
-
|
|
80
|
+
config.command !== "build" && createWatcher();
|
|
78
81
|
},
|
|
79
82
|
async handleHotUpdate({ file, read }) {
|
|
80
83
|
if (file.includes("src/pages") && file.endsWith("index.vue")) {
|