@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.
@@ -0,0 +1,4 @@
1
+ //#region src/express.d.ts
2
+ declare const handle: (expressModule: any) => any;
3
+ //#endregion
4
+ export { handle };
@@ -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 routes;
74
+ return {
75
+ routes,
76
+ additionalFolders,
77
+ additionalDeps
78
+ };
63
79
  };
64
80
 
65
81
  //#endregion
@@ -0,0 +1,9 @@
1
+ //#region src/hono.d.ts
2
+ declare const handle: (honoModule: any) => {
3
+ new (...args: any[]): {
4
+ [x: string]: any;
5
+ };
6
+ [x: string]: any;
7
+ };
8
+ //#endregion
9
+ export { handle };
@@ -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 | undefined;
37
+ version: string;
23
38
  };
39
+ additionalFolders: string[];
40
+ additionalDeps: string[];
24
41
  }>;
25
42
  //#endregion
26
43
  export { introspectApp };