@zphhpzzph/vue-route-gen 1.0.0 → 2.0.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/README.md +709 -36
- package/dist/extract-meta.d.ts +33 -0
- package/dist/extract-meta.d.ts.map +1 -0
- package/dist/extract-meta.js +137 -0
- package/dist/extract-meta.js.map +1 -0
- package/dist/hooks.d.ts +45 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +30 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +327 -24
- package/dist/index.js.map +1 -1
- package/dist/vite.d.ts +51 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +242 -0
- package/dist/vite.js.map +1 -0
- package/package.json +27 -7
package/dist/vite.js
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { generateRoutes } from './index.js';
|
|
3
|
+
import { extractRouteMeta, extractRouteConfig } from './extract-meta.js';
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
/**
|
|
6
|
+
* Vite plugin to handle <route> custom blocks and defineRoute() macro in Vue SFC files
|
|
7
|
+
*
|
|
8
|
+
* This plugin removes:
|
|
9
|
+
* 1. <route> custom blocks from Vue files during development/build
|
|
10
|
+
* 2. defineRoute() macro calls from <script setup>
|
|
11
|
+
*
|
|
12
|
+
* These are extracted at build time by vue-route-gen and merged into route config,
|
|
13
|
+
* so they should be ignored at runtime to avoid parse errors.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // vite.config.ts
|
|
18
|
+
* import { defineConfig } from 'vite';
|
|
19
|
+
* import vue from '@vitejs/plugin-vue';
|
|
20
|
+
* import { routeBlockPlugin } from '@zphhpzzph/vue-route-gen/vite';
|
|
21
|
+
*
|
|
22
|
+
* export default defineConfig({
|
|
23
|
+
* plugins: [
|
|
24
|
+
* routeBlockPlugin(),
|
|
25
|
+
* vue(),
|
|
26
|
+
* ],
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function routeBlockPlugin() {
|
|
31
|
+
return {
|
|
32
|
+
name: 'vue-route-blocks',
|
|
33
|
+
enforce: 'pre',
|
|
34
|
+
transform(code, id) {
|
|
35
|
+
if (!id.endsWith('.vue')) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
let transformed = code;
|
|
39
|
+
let hasChanges = false;
|
|
40
|
+
// Remove <route> custom blocks from the code
|
|
41
|
+
// They've already been extracted by vue-route-gen
|
|
42
|
+
const routeBlockRemoved = transformed.replace(/<route[^>]*>[\s\S]*?<\/route>/gi, '');
|
|
43
|
+
if (routeBlockRemoved !== transformed) {
|
|
44
|
+
transformed = routeBlockRemoved;
|
|
45
|
+
hasChanges = true;
|
|
46
|
+
}
|
|
47
|
+
// Remove defineRoute() calls from <script setup>
|
|
48
|
+
// Keep the import statement, remove the call
|
|
49
|
+
const defineRouteRemoved = removeDefineRouteCalls(transformed);
|
|
50
|
+
if (defineRouteRemoved !== transformed) {
|
|
51
|
+
transformed = defineRouteRemoved;
|
|
52
|
+
hasChanges = true;
|
|
53
|
+
}
|
|
54
|
+
// Only return transformed code if something changed
|
|
55
|
+
if (hasChanges) {
|
|
56
|
+
return {
|
|
57
|
+
code: transformed,
|
|
58
|
+
map: null, // No source map needed for this simple transformation
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Vite plugin for auto-generating routes with intelligent incremental updates
|
|
67
|
+
*
|
|
68
|
+
* This plugin:
|
|
69
|
+
* 1. Generates routes on server start
|
|
70
|
+
* 2. Watches for file changes in pages directory
|
|
71
|
+
* 3. Performs incremental updates when only route config changes
|
|
72
|
+
* 4. Only regenerates when route structure changes (add/remove files)
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* // vite.config.ts
|
|
77
|
+
* import { defineConfig } from 'vite';
|
|
78
|
+
* import { routeGenPlugin } from '@zphhpzzph/vue-route-gen/vite';
|
|
79
|
+
*
|
|
80
|
+
* export default defineConfig({
|
|
81
|
+
* plugins: [routeGenPlugin()],
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export function routeGenPlugin(options) {
|
|
86
|
+
let server;
|
|
87
|
+
const pagesDir = path.resolve(process.cwd(), options?.pagesDir || 'src/pages');
|
|
88
|
+
const outFile = path.resolve(process.cwd(), options?.outFile || 'src/router/route.gen.ts');
|
|
89
|
+
// Cache file metadata for incremental updates
|
|
90
|
+
const fileCache = new Map();
|
|
91
|
+
const shouldHandle = (file) => {
|
|
92
|
+
const normalized = path.resolve(file);
|
|
93
|
+
return normalized.startsWith(`${pagesDir}${path.sep}`) && normalized.endsWith('.vue');
|
|
94
|
+
};
|
|
95
|
+
const getFileHash = (filePath) => {
|
|
96
|
+
try {
|
|
97
|
+
const stats = fs.statSync(filePath);
|
|
98
|
+
return `${stats.mtimeMs}-${stats.size}`;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return '0';
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Check if file changes require full regeneration
|
|
106
|
+
* Returns true if route structure changed (add/remove/rename files)
|
|
107
|
+
* Returns false if only route config/meta changed (can be incremental)
|
|
108
|
+
*/
|
|
109
|
+
const needsFullRegeneration = (file, event) => {
|
|
110
|
+
// Add/unlink always require full regeneration (route structure changes)
|
|
111
|
+
if (event === 'add' || event === 'unlink') {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
// For changes, check if it's just route config/meta or actual content
|
|
115
|
+
const filePath = path.resolve(file);
|
|
116
|
+
const currentHash = getFileHash(filePath);
|
|
117
|
+
const cached = fileCache.get(filePath);
|
|
118
|
+
if (!cached) {
|
|
119
|
+
return true; // No cache, need full regeneration
|
|
120
|
+
}
|
|
121
|
+
// If file hash changed, extract new config and compare
|
|
122
|
+
if (cached.hash !== currentHash) {
|
|
123
|
+
try {
|
|
124
|
+
const newMeta = extractRouteMeta(filePath);
|
|
125
|
+
const newConfig = extractRouteConfig(filePath);
|
|
126
|
+
// Compare with cached config
|
|
127
|
+
const metaChanged = JSON.stringify(cached.meta) !== JSON.stringify(newMeta);
|
|
128
|
+
const configChanged = JSON.stringify(cached.config) !== JSON.stringify(newConfig);
|
|
129
|
+
// Update cache
|
|
130
|
+
fileCache.set(filePath, { meta: newMeta, config: newConfig, hash: currentHash });
|
|
131
|
+
// Config/meta changes can be handled incrementally
|
|
132
|
+
// But for simplicity and correctness, we'll regenerate for now
|
|
133
|
+
// TODO: Implement true incremental updates
|
|
134
|
+
return metaChanged || configChanged;
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return true; // Error reading file, regenerate
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return false;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Handle file changes with intelligent update strategy
|
|
144
|
+
*/
|
|
145
|
+
const onChange = async (file, event) => {
|
|
146
|
+
if (!shouldHandle(file)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const filePath = path.resolve(file);
|
|
150
|
+
const needsFull = needsFullRegeneration(file, event);
|
|
151
|
+
if (needsFull) {
|
|
152
|
+
// Full regeneration for route structure changes
|
|
153
|
+
const updated = generateRoutes({ pagesDir, outFile, ...options });
|
|
154
|
+
if (updated && server) {
|
|
155
|
+
// Invalidate route gen module cache
|
|
156
|
+
const module = server.moduleGraph.getModuleById(outFile);
|
|
157
|
+
if (module) {
|
|
158
|
+
server.moduleGraph.invalidateModule(module);
|
|
159
|
+
}
|
|
160
|
+
// Trigger full reload to ensure route changes take effect
|
|
161
|
+
server.ws.send({ type: 'full-reload', path: '*' });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
// Incremental update: only update the changed file's config
|
|
166
|
+
// This is a placeholder for future incremental update logic
|
|
167
|
+
// For now, we still regenerate to ensure correctness
|
|
168
|
+
const updated = generateRoutes({ pagesDir, outFile, ...options });
|
|
169
|
+
if (updated && server) {
|
|
170
|
+
const module = server.moduleGraph.getModuleById(outFile);
|
|
171
|
+
if (module) {
|
|
172
|
+
server.moduleGraph.invalidateModule(module);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
return {
|
|
178
|
+
name: 'vue-route-gen',
|
|
179
|
+
enforce: 'pre',
|
|
180
|
+
buildStart() {
|
|
181
|
+
// Generate routes on build
|
|
182
|
+
generateRoutes({ pagesDir, outFile, ...options });
|
|
183
|
+
},
|
|
184
|
+
configureServer(_server) {
|
|
185
|
+
server = _server;
|
|
186
|
+
// Initial generation
|
|
187
|
+
generateRoutes({ pagesDir, outFile, ...options });
|
|
188
|
+
// Watch for file changes
|
|
189
|
+
const watcher = server.watcher;
|
|
190
|
+
watcher.on('add', (file) => onChange(file, 'add'));
|
|
191
|
+
watcher.on('unlink', (file) => onChange(file, 'unlink'));
|
|
192
|
+
watcher.on('change', (file) => onChange(file, 'change'));
|
|
193
|
+
},
|
|
194
|
+
// Handle virtual module for route gen file
|
|
195
|
+
resolveId(id) {
|
|
196
|
+
if (id === outFile) {
|
|
197
|
+
return outFile;
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
async load(id) {
|
|
201
|
+
if (id === outFile) {
|
|
202
|
+
// Read the generated file
|
|
203
|
+
try {
|
|
204
|
+
return fs.readFileSync(outFile, 'utf-8');
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
// File doesn't exist yet, generate it
|
|
208
|
+
generateRoutes({ pagesDir, outFile, ...options });
|
|
209
|
+
return fs.readFileSync(outFile, 'utf-8');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
// Hot Module Replacement for route gen file
|
|
214
|
+
handleHotUpdate({ file, modules }) {
|
|
215
|
+
if (file === outFile) {
|
|
216
|
+
server.ws.send({
|
|
217
|
+
type: 'full-reload',
|
|
218
|
+
path: '*',
|
|
219
|
+
});
|
|
220
|
+
return []; // Prevent default HMR handling
|
|
221
|
+
}
|
|
222
|
+
return modules;
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Remove defineRoute() calls from Vue SFC code
|
|
228
|
+
* Preserves import statements while removing the macro calls
|
|
229
|
+
*/
|
|
230
|
+
function removeDefineRouteCalls(code) {
|
|
231
|
+
// Pattern to match defineRoute() calls
|
|
232
|
+
// Supports:
|
|
233
|
+
// - const xxx = defineRoute(...)
|
|
234
|
+
// - defineRoute(...)
|
|
235
|
+
// - With or without variable assignment
|
|
236
|
+
// - With or without trailing semicolon
|
|
237
|
+
const defineRoutePattern = /(?:const|let|var)?\s*\w+\s*=\s*defineRoute\s*\([^)]*\)\s*(?:;|$)?\s*\n?/g;
|
|
238
|
+
// Replace with a comment
|
|
239
|
+
return code.replace(defineRoutePattern, '// defineRoute() extracted by vue-route-gen\n');
|
|
240
|
+
}
|
|
241
|
+
export default routeBlockPlugin;
|
|
242
|
+
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAA8B,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAAI,EAAE,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BAAqB;IACrB,wCAAwC;IACxC,uCAAuC;IACvC,MAAM,kBAAkB,GAAG,0EAA0E,CAAC;IAEtG,yBAAyB;IACzB,OAAO,IAAI,CAAC,OAAO,CACjB,kBAAkB,EAClB,+CAA+C,CAChD,CAAC;AACJ,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zphhpzzph/vue-route-gen",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Vue 3 route generator for file-based routing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"import": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts"
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./vite": {
|
|
15
|
+
"import": "./dist/vite.js",
|
|
16
|
+
"types": "./dist/vite.d.ts",
|
|
17
|
+
"default": "./dist/vite.js"
|
|
12
18
|
}
|
|
13
19
|
},
|
|
14
20
|
"files": [
|
|
@@ -20,8 +26,16 @@
|
|
|
20
26
|
"scripts": {
|
|
21
27
|
"build": "tsc",
|
|
22
28
|
"dev": "tsc --watch",
|
|
29
|
+
"type-check": "tsc -b",
|
|
23
30
|
"prepublishOnly": "pnpm run build",
|
|
24
|
-
"
|
|
31
|
+
"pre-release": "pnpm run build && npm publish --access public --registry https://registry.npmjs.org/",
|
|
32
|
+
"release": "pnpm run build && npm publish --access public --registry https://registry.npmjs.org/",
|
|
33
|
+
"release:patch": "npm version patch && pnpm run release",
|
|
34
|
+
"release:minor": "npm version minor && pnpm run release",
|
|
35
|
+
"release:major": "npm version major && pnpm run release",
|
|
36
|
+
"release:pre": "npm version prepatch && pnpm run pre-release",
|
|
37
|
+
"release:preminor": "npm version preminor && pnpm run pre-release",
|
|
38
|
+
"release:premajor": "npm version premajor && pnpm run pre-release"
|
|
25
39
|
},
|
|
26
40
|
"keywords": [
|
|
27
41
|
"vue",
|
|
@@ -36,12 +50,15 @@
|
|
|
36
50
|
},
|
|
37
51
|
"repository": {
|
|
38
52
|
"type": "git",
|
|
39
|
-
"url": "https://github.com/z-ph/
|
|
53
|
+
"url": "https://github.com/z-ph/zphhpzzph-front.git",
|
|
40
54
|
"directory": "packages/vue-route-gen"
|
|
41
55
|
},
|
|
42
|
-
"homepage": "https://github.com/z-ph/
|
|
56
|
+
"homepage": "https://github.com/z-ph/zphhpzzph-front/tree/main/packages/vue-route-gen#readme",
|
|
43
57
|
"bugs": {
|
|
44
|
-
"url": "https://github.com/z-ph/
|
|
58
|
+
"url": "https://github.com/z-ph/zphhpzzph-front/issues"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"vue-router": "^4.0.0"
|
|
45
62
|
},
|
|
46
63
|
"devDependencies": {
|
|
47
64
|
"@types/node": "^20.11.0",
|
|
@@ -49,5 +66,8 @@
|
|
|
49
66
|
},
|
|
50
67
|
"engines": {
|
|
51
68
|
"node": ">=18.0.0"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@vue/compiler-sfc": "^3.5.26"
|
|
52
72
|
}
|
|
53
|
-
}
|
|
73
|
+
}
|