@vercel/introspection 0.0.4 → 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
@@ -53302,7 +53302,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
53302
53302
  }
53303
53303
  var Lambda = class {
53304
53304
  constructor(opts) {
53305
- const { handler, runtime, runtimeLanguage, maxDuration, architecture, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, supportsResponseStreaming, experimentalResponseStreaming, operationType, framework, experimentalTriggers, supportsCancellation } = opts;
53305
+ const { handler, runtime, runtimeLanguage, maxDuration, architecture, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, supportsResponseStreaming, experimentalResponseStreaming, operationType, framework, experimentalTriggers, supportsCancellation, shouldDisableAutomaticFetchInstrumentation } = opts;
53306
53306
  if ("files" in opts) (0, import_assert4.default)(typeof opts.files === "object", "\"files\" must be an object");
53307
53307
  if ("zipBuffer" in opts) (0, import_assert4.default)(Buffer.isBuffer(opts.zipBuffer), "\"zipBuffer\" must be a Buffer");
53308
53308
  (0, import_assert4.default)(typeof handler === "string", "\"handler\" is not a string");
@@ -53374,6 +53374,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
53374
53374
  this.experimentalAllowBundling = "experimentalAllowBundling" in opts ? opts.experimentalAllowBundling : void 0;
53375
53375
  this.experimentalTriggers = experimentalTriggers;
53376
53376
  this.supportsCancellation = supportsCancellation;
53377
+ this.shouldDisableAutomaticFetchInstrumentation = shouldDisableAutomaticFetchInstrumentation;
53377
53378
  }
53378
53379
  async createZip() {
53379
53380
  let { zipBuffer } = this;
@@ -54964,7 +54965,6 @@ const introspectApp = async (args) => {
54964
54965
  const cjsLoaderPath = fileURLToPath(new URL("loaders/cjs.cjs", import.meta.url));
54965
54966
  const esmLoaderPath = new URL("loaders/esm.mjs", import.meta.url).href;
54966
54967
  const handlerPath = join(args.dir, args.handler);
54967
- let introspectionData = null;
54968
54968
  const introspectionSchema = z.object({
54969
54969
  frameworkSlug: z.string().optional(),
54970
54970
  routes: z.array(z.object({
@@ -54980,6 +54980,7 @@ const introspectApp = async (args) => {
54980
54980
  }),
54981
54981
  additionalDeps: z.array(z.string()).optional()
54982
54982
  });
54983
+ let introspectionData;
54983
54984
  await new Promise((resolvePromise) => {
54984
54985
  try {
54985
54986
  const child = spawn("node", [
@@ -55002,7 +55003,7 @@ const introspectApp = async (args) => {
55002
55003
  });
55003
55004
  child.stdout?.on("data", (data) => {
55004
55005
  try {
55005
- introspectionData = data.toString();
55006
+ introspectionData = introspectionSchema.parse(JSON.parse(data.toString() || "{}"));
55006
55007
  } catch (error) {}
55007
55008
  });
55008
55009
  const timeout = setTimeout(() => {
@@ -55026,21 +55027,20 @@ const introspectApp = async (args) => {
55026
55027
  resolvePromise(void 0);
55027
55028
  }
55028
55029
  });
55029
- const introspectionResult = introspectionSchema.safeParse(JSON.parse(introspectionData || "{}"));
55030
55030
  const framework = getFramework(args);
55031
- if (!introspectionResult.success) return defaultResult(args);
55031
+ if (!introspectionData) return defaultResult(args);
55032
55032
  return {
55033
55033
  routes: [
55034
55034
  { handle: "filesystem" },
55035
- ...introspectionResult.data.routes,
55035
+ ...introspectionData.routes,
55036
55036
  {
55037
55037
  src: "/(.*)",
55038
55038
  dest: "/"
55039
55039
  }
55040
55040
  ],
55041
55041
  framework,
55042
- additionalFolders: introspectionResult.data.additionalFolders ?? [],
55043
- additionalDeps: introspectionResult.data.additionalDeps ?? []
55042
+ additionalFolders: introspectionData.additionalFolders ?? [],
55043
+ additionalDeps: introspectionData.additionalDeps ?? []
55044
55044
  };
55045
55045
  };
55046
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.4",
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
- "@vercel/nft": "1.1.0",
35
+ "@vercel/nft": "1.1.1",
37
36
  "@types/node": "22",
38
37
  "fs-extra": "11.1.0",
39
- "@vercel/build-utils": "13.2.0",
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",