@vercel/introspection 0.0.2 → 0.0.3
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/express.d.mts +4 -0
- package/dist/{express.js → express.mjs} +20 -4
- package/dist/hono.d.mts +9 -0
- package/dist/{index-CnN1IbAv.d.ts → index.d.mts} +18 -1
- package/dist/index.mjs +55074 -0
- package/dist/loaders/cjs.cjs +20 -4
- package/dist/loaders/cjs.d.cts +1 -0
- package/dist/loaders/esm.d.mts +1 -0
- package/dist/loaders/{esm.js → esm.mjs} +1 -1
- package/dist/loaders/hooks.d.mts +5 -0
- package/dist/loaders/{hooks.js → hooks.mjs} +2 -2
- package/package.json +8 -6
- package/dist/index.js +0 -103
- /package/dist/{hono.js → hono.mjs} +0 -0
|
@@ -28,14 +28,22 @@ const handle = (expressModule) => {
|
|
|
28
28
|
return expressModule;
|
|
29
29
|
};
|
|
30
30
|
setupCloseHandlers(() => {
|
|
31
|
-
const routes = extractRoutes();
|
|
31
|
+
const { routes, additionalFolders, additionalDeps } = extractRoutes();
|
|
32
32
|
if (routes.length > 0) return {
|
|
33
33
|
frameworkSlug: "express",
|
|
34
|
-
routes
|
|
34
|
+
routes,
|
|
35
|
+
additionalFolders,
|
|
36
|
+
additionalDeps
|
|
35
37
|
};
|
|
36
38
|
});
|
|
37
39
|
const extractRoutes = () => {
|
|
38
|
-
if (!app) return
|
|
40
|
+
if (!app) return {
|
|
41
|
+
routes: [],
|
|
42
|
+
additionalFolders: [],
|
|
43
|
+
additionalDeps: []
|
|
44
|
+
};
|
|
45
|
+
const additionalFolders = [];
|
|
46
|
+
const additionalDeps = [];
|
|
39
47
|
const routes = [];
|
|
40
48
|
const methods = [
|
|
41
49
|
"all",
|
|
@@ -48,6 +56,10 @@ const extractRoutes = () => {
|
|
|
48
56
|
"head"
|
|
49
57
|
];
|
|
50
58
|
const router = app._router || app.router;
|
|
59
|
+
if ("settings" in app) {
|
|
60
|
+
if ("views" in app.settings && typeof app.settings.views === "string") additionalFolders.push(app.settings.views);
|
|
61
|
+
if ("view engine" in app.settings && typeof app.settings["view engine"] === "string") additionalDeps.push(app.settings["view engine"]);
|
|
62
|
+
}
|
|
51
63
|
for (const route of router.stack) if (route.route) {
|
|
52
64
|
const m = [];
|
|
53
65
|
for (const method of methods) if (route.route.methods[method]) m.push(method.toUpperCase());
|
|
@@ -59,7 +71,11 @@ const extractRoutes = () => {
|
|
|
59
71
|
methods: m
|
|
60
72
|
});
|
|
61
73
|
}
|
|
62
|
-
return
|
|
74
|
+
return {
|
|
75
|
+
routes,
|
|
76
|
+
additionalFolders,
|
|
77
|
+
additionalDeps
|
|
78
|
+
};
|
|
63
79
|
};
|
|
64
80
|
|
|
65
81
|
//#endregion
|
package/dist/hono.d.mts
ADDED
|
@@ -2,8 +2,23 @@
|
|
|
2
2
|
declare const introspectApp: (args: {
|
|
3
3
|
dir: string;
|
|
4
4
|
handler: string;
|
|
5
|
+
framework: string | null | undefined;
|
|
5
6
|
env: Record<string, string | undefined>;
|
|
6
7
|
}) => Promise<{
|
|
8
|
+
routes: ({
|
|
9
|
+
handle: string;
|
|
10
|
+
src?: undefined;
|
|
11
|
+
dest?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
src: string;
|
|
14
|
+
dest: string;
|
|
15
|
+
handle?: undefined;
|
|
16
|
+
})[];
|
|
17
|
+
framework: {
|
|
18
|
+
slug: string;
|
|
19
|
+
version: string;
|
|
20
|
+
};
|
|
21
|
+
} | {
|
|
7
22
|
routes: ({
|
|
8
23
|
src: string;
|
|
9
24
|
dest: string;
|
|
@@ -19,8 +34,10 @@ declare const introspectApp: (args: {
|
|
|
19
34
|
})[];
|
|
20
35
|
framework: {
|
|
21
36
|
slug: string;
|
|
22
|
-
version: string
|
|
37
|
+
version: string;
|
|
23
38
|
};
|
|
39
|
+
additionalFolders: string[];
|
|
40
|
+
additionalDeps: string[];
|
|
24
41
|
}>;
|
|
25
42
|
//#endregion
|
|
26
43
|
export { introspectApp };
|