vite-plugin-generoutes 2.0.0-beta.3 → 2.0.1

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -5
  2. package/package.json +19 -22
package/dist/index.js CHANGED
@@ -2,7 +2,6 @@
2
2
  import path from "path";
3
3
  import { styleText } from "util";
4
4
  import { debounce, slash } from "@antfu/utils";
5
- import { parse } from "@vue/compiler-sfc";
6
5
  import fs from "fs-extra";
7
6
  import { globSync } from "glob";
8
7
  import prettier from "prettier";
@@ -190,10 +189,8 @@ export type GeneratedRoute = RouteRecordRaw & {
190
189
  }
191
190
  function parseDefineOptions(filePath, content) {
192
191
  content = content ?? fs.readFileSync(filePath, "utf-8");
193
- const { descriptor } = parse(content);
194
- const setupScript = descriptor.scriptSetup?.content;
195
- if (setupScript) {
196
- const defineOptionsMatch = setupScript.match(/defineOptions\s*\(\s*(\{[\s\S]*?\})\s*\)/);
192
+ if (content) {
193
+ const defineOptionsMatch = content.match(/defineOptions\s*\(\s*(\{[\s\S]*?\})\s*\)/);
197
194
  if (defineOptionsMatch) {
198
195
  try {
199
196
  return new Function(`return ${defineOptionsMatch[1]}`)();
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "vite-plugin-generoutes",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.3",
5
- "packageManager": "pnpm@10.27.0",
4
+ "version": "2.0.1",
6
5
  "description": "A Vite plugin that generate routes based on the file structure, supports dynamic routes, and supports custom meta data for each route.",
7
6
  "author": "Ronnie Zhang <zclzone@outlook.com>",
8
7
  "license": "MIT",
@@ -34,49 +33,47 @@
34
33
  "files": [
35
34
  "dist"
36
35
  ],
37
- "scripts": {
38
- "start": "tsup --watch",
39
- "build": "tsup",
40
- "lint": "eslint .",
41
- "prepublishOnly": "nr build",
42
- "release": "bumpp && npm publish",
43
- "test": "vitest",
44
- "prepare": "simple-git-hooks",
45
- "up:deps": "taze major -I"
46
- },
47
36
  "peerDependencies": {
48
- "vite": ">=6.1.0",
37
+ "vite": ">=6.4.1",
49
38
  "vue-router": ">=4.0.0"
50
39
  },
51
40
  "dependencies": {
52
41
  "@antfu/utils": "^9.3.0",
53
- "@vue/compiler-sfc": "^3.5.26",
54
42
  "fs-extra": "^11.3.3",
55
43
  "glob": "^13.0.0",
56
- "prettier": "^3.7.4"
44
+ "prettier": "^3.8.1"
57
45
  },
58
46
  "devDependencies": {
59
- "@antfu/eslint-config": "^6.7.3",
47
+ "@antfu/eslint-config": "^7.2.0",
48
+ "@antfu/ni": "^28.2.0",
60
49
  "@types/fs-extra": "^11.0.4",
61
- "@types/node": "^25.0.3",
62
- "bumpp": "^10.1.0",
50
+ "@types/node": "^25.2.0",
51
+ "bumpp": "^10.4.0",
63
52
  "eslint": "^9.39.2",
64
53
  "esno": "^4.8.0",
65
54
  "lint-staged": "^16.2.7",
66
- "pnpm": "^10.27.0",
55
+ "pnpm": "^10.28.2",
67
56
  "rimraf": "^6.1.2",
68
57
  "simple-git-hooks": "^2.13.1",
69
58
  "taze": "^19.9.2",
70
59
  "tsup": "^8.5.1",
71
60
  "typescript": "^5.9.3",
72
61
  "unbuild": "^3.6.1",
73
- "vitest": "^4.0.16",
74
- "vue-router": "^4.6.4"
62
+ "vitest": "^4.0.18",
63
+ "vue-router": "^5.0.1"
75
64
  },
76
65
  "simple-git-hooks": {
77
66
  "pre-commit": "pnpm lint-staged"
78
67
  },
79
68
  "lint-staged": {
80
69
  "*": "eslint --fix"
70
+ },
71
+ "scripts": {
72
+ "start": "tsup --watch",
73
+ "build": "tsup",
74
+ "lint": "eslint .",
75
+ "release": "bumpp && npm publish",
76
+ "test": "vitest",
77
+ "up:deps": "taze major -I"
81
78
  }
82
- }
79
+ }