@vercel/introspection 0.0.5 → 0.0.6

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/index.mjs CHANGED
@@ -54965,7 +54965,6 @@ const introspectApp = async (args) => {
54965
54965
  const cjsLoaderPath = fileURLToPath(new URL("loaders/cjs.cjs", import.meta.url));
54966
54966
  const esmLoaderPath = new URL("loaders/esm.mjs", import.meta.url).href;
54967
54967
  const handlerPath = join(args.dir, args.handler);
54968
- let introspectionData = null;
54969
54968
  const introspectionSchema = z.object({
54970
54969
  frameworkSlug: z.string().optional(),
54971
54970
  routes: z.array(z.object({
@@ -54981,6 +54980,7 @@ const introspectApp = async (args) => {
54981
54980
  }),
54982
54981
  additionalDeps: z.array(z.string()).optional()
54983
54982
  });
54983
+ let introspectionData;
54984
54984
  await new Promise((resolvePromise) => {
54985
54985
  try {
54986
54986
  const child = spawn("node", [
@@ -55003,7 +55003,7 @@ const introspectApp = async (args) => {
55003
55003
  });
55004
55004
  child.stdout?.on("data", (data) => {
55005
55005
  try {
55006
- introspectionData = data.toString();
55006
+ introspectionData = introspectionSchema.parse(JSON.parse(data.toString() || "{}"));
55007
55007
  } catch (error) {}
55008
55008
  });
55009
55009
  const timeout = setTimeout(() => {
@@ -55027,21 +55027,20 @@ const introspectApp = async (args) => {
55027
55027
  resolvePromise(void 0);
55028
55028
  }
55029
55029
  });
55030
- const introspectionResult = introspectionSchema.safeParse(JSON.parse(introspectionData || "{}"));
55031
55030
  const framework = getFramework(args);
55032
- if (!introspectionResult.success) return defaultResult(args);
55031
+ if (!introspectionData) return defaultResult(args);
55033
55032
  return {
55034
55033
  routes: [
55035
55034
  { handle: "filesystem" },
55036
- ...introspectionResult.data.routes,
55035
+ ...introspectionData.routes,
55037
55036
  {
55038
55037
  src: "/(.*)",
55039
55038
  dest: "/"
55040
55039
  }
55041
55040
  ],
55042
55041
  framework,
55043
- additionalFolders: introspectionResult.data.additionalFolders ?? [],
55044
- additionalDeps: introspectionResult.data.additionalDeps ?? []
55042
+ additionalFolders: introspectionData.additionalFolders ?? [],
55043
+ additionalDeps: introspectionData.additionalDeps ?? []
55045
55044
  };
55046
55045
  };
55047
55046
  const defaultResult = (args) => {
@@ -140,6 +140,22 @@ const extractRoutes = () => {
140
140
  };
141
141
  };
142
142
 
143
+ //#endregion
144
+ //#region src/loaders/block-network.ts
145
+ for (const mod of [
146
+ "net",
147
+ "dns",
148
+ "http",
149
+ "https",
150
+ "tls",
151
+ "dgram"
152
+ ]) try {
153
+ const m = require(mod);
154
+ for (const key of Object.keys(m)) m[key] = new Proxy(m[key], { apply() {
155
+ throw new Error("Networking is disabled");
156
+ } });
157
+ } catch {}
158
+
143
159
  //#endregion
144
160
  //#region src/loaders/cjs.ts
145
161
  const originalRequire = module$1.default.prototype.require;
@@ -1,5 +1,25 @@
1
- import { register } from "node:module";
1
+ import { createRequire, register } from "node:module";
2
2
 
3
+ //#region rolldown:runtime
4
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
+
6
+ //#endregion
7
+ //#region src/loaders/block-network.ts
8
+ for (const mod of [
9
+ "net",
10
+ "dns",
11
+ "http",
12
+ "https",
13
+ "tls",
14
+ "dgram"
15
+ ]) try {
16
+ const m = __require(mod);
17
+ for (const key of Object.keys(m)) m[key] = new Proxy(m[key], { apply() {
18
+ throw new Error("Networking is disabled");
19
+ } });
20
+ } catch {}
21
+
22
+ //#endregion
3
23
  //#region src/loaders/esm.ts
4
24
  register(new URL("./hooks.mjs", import.meta.url), import.meta.url);
5
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/introspection",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://vercel.com/docs",
6
6
  "type": "module",
@@ -32,18 +32,18 @@
32
32
  "@types/express": "5.0.3",
33
33
  "@types/fs-extra": "11",
34
34
  "@types/jest": "27.5.1",
35
- "@vercel/static-config": "3.1.2",
36
35
  "@vercel/nft": "1.1.1",
37
36
  "@types/node": "22",
38
37
  "fs-extra": "11.1.0",
39
- "@vercel/build-utils": "13.2.2",
40
38
  "execa": "3.2.0",
41
39
  "hono": "4.10.1",
42
40
  "jest-junit": "16.0.0",
43
41
  "tsdown": "0.16.3",
44
42
  "vite": "^5.1.6",
45
43
  "vitest": "^2.0.1",
46
- "@vercel/cervel": "0.0.6"
44
+ "@vercel/cervel": "0.0.6",
45
+ "@vercel/build-utils": "13.2.3",
46
+ "@vercel/static-config": "3.1.2"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsdown",