@agentuity/cli 1.0.38 → 1.0.40
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/cmd/build/app-router-detector.d.ts +42 -0
- package/dist/cmd/build/app-router-detector.d.ts.map +1 -0
- package/dist/cmd/build/app-router-detector.js +253 -0
- package/dist/cmd/build/app-router-detector.js.map +1 -0
- package/dist/cmd/build/ast.d.ts +11 -1
- package/dist/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +273 -29
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/entry-generator.d.ts.map +1 -1
- package/dist/cmd/build/entry-generator.js +23 -16
- package/dist/cmd/build/entry-generator.js.map +1 -1
- package/dist/cmd/build/vite/bundle-files.d.ts +12 -0
- package/dist/cmd/build/vite/bundle-files.d.ts.map +1 -0
- package/dist/cmd/build/vite/bundle-files.js +107 -0
- package/dist/cmd/build/vite/bundle-files.js.map +1 -0
- package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/registry-generator.js +37 -13
- package/dist/cmd/build/vite/registry-generator.js.map +1 -1
- package/dist/cmd/build/vite/route-discovery.d.ts +17 -3
- package/dist/cmd/build/vite/route-discovery.d.ts.map +1 -1
- package/dist/cmd/build/vite/route-discovery.js +91 -3
- package/dist/cmd/build/vite/route-discovery.js.map +1 -1
- package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-builder.js +9 -0
- package/dist/cmd/build/vite/vite-builder.js.map +1 -1
- package/dist/cmd/build/vite-bundler.d.ts.map +1 -1
- package/dist/cmd/build/vite-bundler.js +3 -0
- package/dist/cmd/build/vite-bundler.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +30 -0
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/route-migration.d.ts +61 -0
- package/dist/utils/route-migration.d.ts.map +1 -0
- package/dist/utils/route-migration.js +662 -0
- package/dist/utils/route-migration.js.map +1 -0
- package/package.json +6 -6
- package/src/cmd/build/app-router-detector.ts +350 -0
- package/src/cmd/build/ast.ts +339 -36
- package/src/cmd/build/entry-generator.ts +23 -16
- package/src/cmd/build/vite/bundle-files.ts +135 -0
- package/src/cmd/build/vite/registry-generator.ts +38 -13
- package/src/cmd/build/vite/route-discovery.ts +151 -3
- package/src/cmd/build/vite/vite-builder.ts +11 -0
- package/src/cmd/build/vite-bundler.ts +4 -0
- package/src/cmd/dev/index.ts +34 -0
- package/src/types.ts +9 -0
- package/src/utils/route-migration.ts +793 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App Router Detector
|
|
3
|
+
*
|
|
4
|
+
* Parses the user's `src/app.ts` to detect whether they pass a `router` property
|
|
5
|
+
* to `createApp()`. If detected, resolves the router variable(s) to their import
|
|
6
|
+
* sources and mount paths.
|
|
7
|
+
*
|
|
8
|
+
* This allows the build tooling to derive route metadata from the actual code-based
|
|
9
|
+
* route tree instead of relying on filesystem-based discovery.
|
|
10
|
+
*/
|
|
11
|
+
import type { Logger } from '../../types';
|
|
12
|
+
/**
|
|
13
|
+
* A resolved mount point from `createApp({ router })`.
|
|
14
|
+
*/
|
|
15
|
+
export interface DetectedRouteMount {
|
|
16
|
+
/** Mount path (e.g., '/api', '/api/v1') */
|
|
17
|
+
path: string;
|
|
18
|
+
/** Absolute file path of the router module */
|
|
19
|
+
routerFile: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Result of detecting explicit router usage in app.ts.
|
|
23
|
+
*/
|
|
24
|
+
export interface AppRouterDetection {
|
|
25
|
+
/** Whether `createApp({ router })` was found */
|
|
26
|
+
detected: boolean;
|
|
27
|
+
/** Resolved mount points with their router files */
|
|
28
|
+
mounts: DetectedRouteMount[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Detect whether `src/app.ts` uses `createApp({ router })`.
|
|
32
|
+
*
|
|
33
|
+
* Parses the file with acorn-loose, finds `createApp()` calls,
|
|
34
|
+
* and resolves router variables to their import source files.
|
|
35
|
+
*
|
|
36
|
+
* Returns `{ detected: false, mounts: [] }` when:
|
|
37
|
+
* - `src/app.ts` doesn't exist
|
|
38
|
+
* - `createApp()` is called without a `router` property
|
|
39
|
+
* - Router variables can't be resolved to files
|
|
40
|
+
*/
|
|
41
|
+
export declare function detectExplicitRouter(rootDir: string, logger: Logger): Promise<AppRouterDetection>;
|
|
42
|
+
//# sourceMappingURL=app-router-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-router-detector.d.ts","sourceRoot":"","sources":["../../../src/cmd/build/app-router-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAU1C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC7B;AAgHD;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,kBAAkB,CAAC,CAgB7B"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App Router Detector
|
|
3
|
+
*
|
|
4
|
+
* Parses the user's `src/app.ts` to detect whether they pass a `router` property
|
|
5
|
+
* to `createApp()`. If detected, resolves the router variable(s) to their import
|
|
6
|
+
* sources and mount paths.
|
|
7
|
+
*
|
|
8
|
+
* This allows the build tooling to derive route metadata from the actual code-based
|
|
9
|
+
* route tree instead of relying on filesystem-based discovery.
|
|
10
|
+
*/
|
|
11
|
+
import * as acornLoose from 'acorn-loose';
|
|
12
|
+
import { join, dirname, resolve } from 'node:path';
|
|
13
|
+
import { existsSync, statSync } from 'node:fs';
|
|
14
|
+
/**
|
|
15
|
+
* Resolve an import path to an actual file on disk.
|
|
16
|
+
* Tries the path as-is, then with common extensions.
|
|
17
|
+
*/
|
|
18
|
+
function resolveImportFile(fromDir, importPath) {
|
|
19
|
+
if (!importPath.startsWith('.') && !importPath.startsWith('/')) {
|
|
20
|
+
return null; // Package import — can't resolve
|
|
21
|
+
}
|
|
22
|
+
const basePath = resolve(fromDir, importPath);
|
|
23
|
+
const extensions = ['.ts', '.tsx', '/index.ts', '/index.tsx'];
|
|
24
|
+
if (existsSync(basePath)) {
|
|
25
|
+
try {
|
|
26
|
+
if (statSync(basePath).isFile())
|
|
27
|
+
return basePath;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// ignore
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
for (const ext of extensions) {
|
|
34
|
+
const candidate = basePath + ext;
|
|
35
|
+
if (existsSync(candidate)) {
|
|
36
|
+
return candidate;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Extract the `router` property value from a `createApp()` call's argument object.
|
|
43
|
+
*
|
|
44
|
+
* Handles three forms:
|
|
45
|
+
* - `createApp({ router: myVar })` → plain Hono, default /api mount
|
|
46
|
+
* - `createApp({ router: { path: '/v1', router: myVar } })` → single RouteMount
|
|
47
|
+
* - `createApp({ router: [{ path: '/v1', router: v1 }, ...] })` → array of RouteMounts
|
|
48
|
+
*/
|
|
49
|
+
function extractRouterFromCreateApp(callNode) {
|
|
50
|
+
// createApp() must have at least one argument (the config object)
|
|
51
|
+
if (!callNode.arguments || callNode.arguments.length === 0) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const configArg = callNode.arguments[0];
|
|
55
|
+
if (configArg.type !== 'ObjectExpression') {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
// Find the `router` property
|
|
59
|
+
const routerProp = configArg.properties?.find((p) => p.type === 'Property' && p.key?.type === 'Identifier' && p.key?.name === 'router');
|
|
60
|
+
if (!routerProp) {
|
|
61
|
+
return null; // No router property — file-based routing
|
|
62
|
+
}
|
|
63
|
+
const routerValue = routerProp.value;
|
|
64
|
+
// Form 1: Plain Hono variable → createApp({ router: myRouter })
|
|
65
|
+
if (routerValue.type === 'Identifier') {
|
|
66
|
+
return [{ path: '/api', varName: routerValue.name }];
|
|
67
|
+
}
|
|
68
|
+
// Form 2: Single RouteMount → createApp({ router: { path: '/v1', router: myRouter } })
|
|
69
|
+
if (routerValue.type === 'ObjectExpression') {
|
|
70
|
+
const mount = extractRouteMountFromObject(routerValue);
|
|
71
|
+
return mount ? [mount] : null;
|
|
72
|
+
}
|
|
73
|
+
// Form 3: Array of RouteMounts → createApp({ router: [{ path: '/v1', router: v1 }, ...] })
|
|
74
|
+
if (routerValue.type === 'ArrayExpression') {
|
|
75
|
+
const mounts = [];
|
|
76
|
+
for (const element of routerValue.elements || []) {
|
|
77
|
+
if (element?.type === 'ObjectExpression') {
|
|
78
|
+
const mount = extractRouteMountFromObject(element);
|
|
79
|
+
if (mount)
|
|
80
|
+
mounts.push(mount);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return mounts.length > 0 ? mounts : null;
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Extract { path, router } from an object literal AST node.
|
|
89
|
+
*/
|
|
90
|
+
function extractRouteMountFromObject(objNode) {
|
|
91
|
+
let path;
|
|
92
|
+
let varName;
|
|
93
|
+
for (const prop of objNode.properties || []) {
|
|
94
|
+
if (prop.type !== 'Property' || prop.key?.type !== 'Identifier')
|
|
95
|
+
continue;
|
|
96
|
+
if (prop.key.name === 'path' && prop.value?.type === 'Literal') {
|
|
97
|
+
path = String(prop.value.value);
|
|
98
|
+
}
|
|
99
|
+
if (prop.key.name === 'router' && prop.value?.type === 'Identifier') {
|
|
100
|
+
varName = prop.value.name;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return path && varName ? { path, varName } : null;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Detect whether `src/app.ts` uses `createApp({ router })`.
|
|
107
|
+
*
|
|
108
|
+
* Parses the file with acorn-loose, finds `createApp()` calls,
|
|
109
|
+
* and resolves router variables to their import source files.
|
|
110
|
+
*
|
|
111
|
+
* Returns `{ detected: false, mounts: [] }` when:
|
|
112
|
+
* - `src/app.ts` doesn't exist
|
|
113
|
+
* - `createApp()` is called without a `router` property
|
|
114
|
+
* - Router variables can't be resolved to files
|
|
115
|
+
*/
|
|
116
|
+
export async function detectExplicitRouter(rootDir, logger) {
|
|
117
|
+
const noDetection = { detected: false, mounts: [] };
|
|
118
|
+
// Look for app.ts in src/ (standard location)
|
|
119
|
+
const appFile = join(rootDir, 'src', 'app.ts');
|
|
120
|
+
if (!existsSync(appFile)) {
|
|
121
|
+
// Also try root-level app.ts
|
|
122
|
+
const rootAppFile = join(rootDir, 'app.ts');
|
|
123
|
+
if (!existsSync(rootAppFile)) {
|
|
124
|
+
logger.trace('[router-detect] No app.ts found');
|
|
125
|
+
return noDetection;
|
|
126
|
+
}
|
|
127
|
+
return detectInFile(rootAppFile, logger);
|
|
128
|
+
}
|
|
129
|
+
return detectInFile(appFile, logger);
|
|
130
|
+
}
|
|
131
|
+
async function detectInFile(appFile, logger) {
|
|
132
|
+
const noDetection = { detected: false, mounts: [] };
|
|
133
|
+
const appDir = dirname(appFile);
|
|
134
|
+
try {
|
|
135
|
+
const source = await Bun.file(appFile).text();
|
|
136
|
+
const transpiler = new Bun.Transpiler({ loader: 'ts', target: 'bun' });
|
|
137
|
+
const contents = transpiler.transformSync(source);
|
|
138
|
+
// Quick check: skip AST parsing if createApp is not called with router
|
|
139
|
+
if (!contents.includes('createApp') || !contents.includes('router')) {
|
|
140
|
+
logger.trace('[router-detect] No createApp + router pattern found in %s', appFile);
|
|
141
|
+
return noDetection;
|
|
142
|
+
}
|
|
143
|
+
const ast = acornLoose.parse(contents, {
|
|
144
|
+
locations: true,
|
|
145
|
+
ecmaVersion: 'latest',
|
|
146
|
+
sourceType: 'module',
|
|
147
|
+
});
|
|
148
|
+
// Build import map: variable name → import path
|
|
149
|
+
const importMap = new Map();
|
|
150
|
+
for (const node of ast.body || []) {
|
|
151
|
+
if (node.type === 'ImportDeclaration' && node.source?.value) {
|
|
152
|
+
for (const spec of node.specifiers || []) {
|
|
153
|
+
if (spec.local?.name) {
|
|
154
|
+
importMap.set(spec.local.name, String(node.source.value));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Walk all statements looking for createApp() calls
|
|
160
|
+
const routerMounts = findCreateAppRouterCalls(ast, importMap);
|
|
161
|
+
if (!routerMounts || routerMounts.length === 0) {
|
|
162
|
+
logger.trace('[router-detect] createApp() found but no router property');
|
|
163
|
+
return noDetection;
|
|
164
|
+
}
|
|
165
|
+
// Resolve each router variable to its file
|
|
166
|
+
const mounts = [];
|
|
167
|
+
for (const { path, varName } of routerMounts) {
|
|
168
|
+
const importPath = importMap.get(varName);
|
|
169
|
+
if (!importPath) {
|
|
170
|
+
logger.debug('[router-detect] Router variable %s is not imported — may be defined locally', varName);
|
|
171
|
+
// Could be defined in the same file — skip for now
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
const resolvedFile = resolveImportFile(appDir, importPath);
|
|
175
|
+
if (!resolvedFile) {
|
|
176
|
+
logger.warn('[router-detect] Could not resolve import %s for router variable %s', importPath, varName);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
logger.trace('[router-detect] Found router mount: %s → %s (%s)', path, varName, resolvedFile);
|
|
180
|
+
mounts.push({ path, routerFile: resolvedFile });
|
|
181
|
+
}
|
|
182
|
+
if (mounts.length === 0) {
|
|
183
|
+
logger.debug('[router-detect] Router variables found but none could be resolved to files');
|
|
184
|
+
return noDetection;
|
|
185
|
+
}
|
|
186
|
+
logger.debug('[router-detect] Detected %d explicit router mount(s) in %s', mounts.length, appFile);
|
|
187
|
+
return { detected: true, mounts };
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
logger.warn('[router-detect] Failed to parse %s: %s', appFile, error instanceof Error ? error.message : String(error));
|
|
191
|
+
return noDetection;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Walk the AST looking for `createApp({ router: ... })` calls.
|
|
196
|
+
* Handles:
|
|
197
|
+
* - `createApp({ router })` (top-level expression)
|
|
198
|
+
* - `const app = await createApp({ router })` (variable declaration)
|
|
199
|
+
* - `export const app = await createApp({ router })` (exported)
|
|
200
|
+
*/
|
|
201
|
+
function findCreateAppRouterCalls(ast, importMap) {
|
|
202
|
+
for (const node of ast.body || []) {
|
|
203
|
+
// Check expression statements: createApp({ router })
|
|
204
|
+
if (node.type === 'ExpressionStatement') {
|
|
205
|
+
const result = checkForCreateAppCall(node.expression, importMap);
|
|
206
|
+
if (result)
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
// Check variable declarations: const app = await createApp({ router })
|
|
210
|
+
if (node.type === 'VariableDeclaration') {
|
|
211
|
+
for (const decl of node.declarations || []) {
|
|
212
|
+
if (decl.init) {
|
|
213
|
+
const result = checkForCreateAppCall(decl.init, importMap);
|
|
214
|
+
if (result)
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Check exports: export const app = await createApp({ router })
|
|
220
|
+
if (node.type === 'ExportNamedDeclaration' && node.declaration) {
|
|
221
|
+
if (node.declaration.type === 'VariableDeclaration') {
|
|
222
|
+
for (const decl of node.declaration.declarations || []) {
|
|
223
|
+
if (decl.init) {
|
|
224
|
+
const result = checkForCreateAppCall(decl.init, importMap);
|
|
225
|
+
if (result)
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Check if an expression node is a `createApp({ router })` call.
|
|
236
|
+
* Unwraps `await` expressions.
|
|
237
|
+
*/
|
|
238
|
+
function checkForCreateAppCall(expr, importMap) {
|
|
239
|
+
if (!expr)
|
|
240
|
+
return null;
|
|
241
|
+
// Unwrap AwaitExpression: await createApp(...)
|
|
242
|
+
if (expr.type === 'AwaitExpression' && expr.argument) {
|
|
243
|
+
return checkForCreateAppCall(expr.argument, importMap);
|
|
244
|
+
}
|
|
245
|
+
// Check for createApp({ router })
|
|
246
|
+
if (expr.type === 'CallExpression' &&
|
|
247
|
+
expr.callee?.type === 'Identifier' &&
|
|
248
|
+
expr.callee?.name === 'createApp') {
|
|
249
|
+
return extractRouterFromCreateApp(expr);
|
|
250
|
+
}
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=app-router-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-router-detector.js","sourceRoot":"","sources":["../../../src/cmd/build/app-router-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA+B/C;;;GAGG;AACH,SAAS,iBAAiB,CAAC,OAAe,EAAE,UAAkB;IAC7D,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CA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AC;QAED,gEAAgE;QAChE,IAAI,IAAI,CAAC,IAAI,KAAK,wBAAwB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAChE,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;gBACrD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC;oBACxD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;wBACf,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;wBAC3D,IAAI,MAAM;4BAAE,OAAO,MAAM,CAAC;oBAC3B,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,SAAS,qBAAqB,CAC7B,IAAa,EACb,SAA8B;IAE9B,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,+CAA+C;IAC/C,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtD,OAAO,qBAAqB,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;IAED,kCAAkC;IAClC,IACC,IAAI,CAAC,IAAI,KAAK,gBAAgB;QAC9B,IAAI,CAAC,MAAM,EAAE,IAAI,KAAK,YAAY;QAClC,IAAI,CAAC,MAAM,EAAE,IAAI,KAAK,WAAW,EAChC,CAAC;QACF,OAAO,0BAA0B,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC"}
|
package/dist/cmd/build/ast.d.ts
CHANGED
|
@@ -13,7 +13,17 @@ export declare function parseEvalMetadata(rootDir: string, filename: string, con
|
|
|
13
13
|
}>
|
|
14
14
|
]>;
|
|
15
15
|
export declare function parseAgentMetadata(rootDir: string, filename: string, contents: string, projectId: string, deploymentId: string): Promise<[string, Map<string, string>] | undefined>;
|
|
16
|
-
export
|
|
16
|
+
export interface ParseRouteOptions {
|
|
17
|
+
visitedFiles?: Set<string>;
|
|
18
|
+
mountedSubrouters?: Set<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Explicit mount prefix for this router file, derived from code-based routing
|
|
21
|
+
* (e.g., from `createApp({ router })` or `.route()` calls).
|
|
22
|
+
* When provided, overrides the filesystem-derived mount path.
|
|
23
|
+
*/
|
|
24
|
+
mountPrefix?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function parseRoute(rootDir: string, filename: string, projectId: string, deploymentId: string, visitedFilesOrOptions?: Set<string> | ParseRouteOptions, mountedSubrouters?: Set<string>): Promise<BuildMetadata['routes']>;
|
|
17
27
|
/**
|
|
18
28
|
* Result of workbench analysis
|
|
19
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../src/cmd/build/ast.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAqIxE,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEpF;AAoTD,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC9C,OAAO,CACT;IACC,MAAM;IACN,KAAK,CAAC;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAA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