403Webshell
Server IP : 159.203.156.69  /  Your IP : 216.73.217.172
Web Server : nginx/1.24.0
System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/tanviranik.com/node_modules/vinext/dist/server/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/tanviranik.com/node_modules/vinext/dist/server/instrumentation.js.map
{"version":3,"file":"instrumentation.js","names":[],"sources":["../../src/server/instrumentation.ts"],"sourcesContent":["/**\n * instrumentation.ts support\n *\n * Next.js supports an `instrumentation.ts` file at the project root that\n * exports a `register()` function. This function is called once when the\n * server starts, before any request handling. It's the recommended way to\n * set up observability tools (Sentry, Datadog, OpenTelemetry, etc.).\n *\n * Optionally, it can also export `onRequestError()` which is called when\n * an unhandled error occurs during request handling.\n *\n * References:\n * - https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation\n *\n * ## App Router\n *\n * For App Router, `register()` is baked directly into the generated RSC entry\n * as a top-level `await` at module evaluation time (see `entries/app-rsc-entry.ts`\n * `generateRscEntry`). This means it runs inside the Worker process (or RSC\n * Vite environment) — the same process that handles requests — before any\n * request is served. `runInstrumentation()` is NOT called from `configureServer`\n * for App Router.\n *\n * The `onRequestError` handler is stored on `globalThis` so it is visible across\n * the RSC and SSR Vite environments (separate module graphs, same Node.js process).\n * With `@cloudflare/vite-plugin` it runs entirely inside the Worker, so\n * `globalThis` is the Worker's global — also correct.\n *\n * ## Pages Router\n *\n * Pages Router has no RSC entry, so `configureServer()` is the right place to\n * call `register()`. `runInstrumentation()` accepts a `ModuleRunner` (created\n * via `createDirectRunner()`) rather than `server.ssrLoadModule()` so it is\n * safe when `@cloudflare/vite-plugin` is present — that plugin replaces the\n * SSR environment's hot channel, causing `ssrLoadModule()` to crash with\n * `TypeError: Cannot read properties of undefined (reading 'outsideEmitter')`.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { getRequestExecutionContext } from \"vinext/shims/request-context\";\nimport { ValidFileMatcher } from \"../routing/file-matcher.js\";\n/**\n * Minimal duck-typed interface for the module runner passed to\n * `runInstrumentation`. Only `.import()` is used — this avoids requiring\n * callers (including tests) to provide a full `ModuleRunner` instance.\n */\nexport type ModuleImporter = {\n  import(id: string): Promise<unknown>;\n};\n\n/**\n * Import a module via the runner and cast the result to `Record<string, any>`.\n *\n * Centralises the `as Record<string, any>` cast so callers don't need\n * per-call oxlint-disable comments.\n */\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function importModule(\n  runner: ModuleImporter,\n  id: string,\n  // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n): Promise<Record<string, any>> {\n  // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n  return (await runner.import(id)) as Record<string, any>;\n}\n\nconst INSTRUMENTATION_LOCATIONS = [\"\", \"src/\"];\n\nfunction findInstrumentationHookFile(\n  root: string,\n  basename: string,\n  fileMatcher: ValidFileMatcher,\n): string | null {\n  for (const dir of INSTRUMENTATION_LOCATIONS) {\n    for (const ext of fileMatcher.dottedExtensions) {\n      const fullPath = path.join(root, dir, `${basename}${ext}`);\n      if (fs.existsSync(fullPath)) {\n        return fullPath;\n      }\n    }\n  }\n  return null;\n}\n\n/**\n * Find the instrumentation file in the project root.\n */\nexport function findInstrumentationFile(\n  root: string,\n  fileMatcher: ValidFileMatcher,\n): string | null {\n  return findInstrumentationHookFile(root, \"instrumentation\", fileMatcher);\n}\n\n/**\n * Find the instrumentation-client file in the project root.\n */\nexport function findInstrumentationClientFile(\n  root: string,\n  fileMatcher: ValidFileMatcher,\n): string | null {\n  return findInstrumentationHookFile(root, \"instrumentation-client\", fileMatcher);\n}\n\n/**\n * The onRequestError handler type from Next.js instrumentation.\n *\n * Called when an unhandled error occurs during request handling.\n * Provides the error, the request info, and an error context.\n */\nexport type OnRequestErrorContext = {\n  /** The route path (e.g., '/blog/[slug]') */\n  routerKind: \"Pages Router\" | \"App Router\";\n  /** The matched route pattern */\n  routePath: string;\n  /** The route type */\n  routeType: \"render\" | \"route\" | \"action\" | \"middleware\";\n  /** HTTP status code that will be sent */\n  revalidateReason?: \"on-demand\" | \"stale\" | undefined;\n};\n\nexport type OnRequestErrorHandler = (\n  error: Error,\n  request: { path: string; method: string; headers: Record<string, string> },\n  context: OnRequestErrorContext,\n) => void | Promise<void>;\n\n/**\n * Get the registered onRequestError handler (if any).\n *\n * Reads from globalThis so it works across Vite environment boundaries.\n */\nexport function getOnRequestErrorHandler(): OnRequestErrorHandler | null {\n  return globalThis.__VINEXT_onRequestErrorHandler__ ?? null;\n}\n\n/**\n * Load and execute the instrumentation file via a ModuleRunner.\n *\n * Called once during Pages Router server startup (`configureServer`). It:\n * 1. Loads the instrumentation module via `runner.import()`.\n * 2. Calls the `register()` function if exported.\n * 3. Stores the `onRequestError()` handler on `globalThis` so it is visible\n *    to all Vite environment module graphs (SSR and the host process share\n *    the same Node.js `globalThis`).\n *\n * **App Router** does not use this function. For App Router, `register()` is\n * emitted as a top-level `await` inside the generated RSC entry module so it\n * runs in the same Worker/environment as request handling.\n *\n * @param runner - A ModuleRunner created via `createDirectRunner()`. Must be\n *   the same long-lived runner used for middleware and SSR so the module graph\n *   is shared. Safe with all Vite plugin combinations, including\n *   `@cloudflare/vite-plugin`, because it never touches the hot channel.\n * @param instrumentationPath - Absolute path to the instrumentation file\n */\nexport async function runInstrumentation(\n  runner: ModuleImporter,\n  instrumentationPath: string,\n): Promise<void> {\n  try {\n    const mod = (await runner.import(instrumentationPath)) as Record<string, unknown>;\n\n    // Call register() if exported\n    if (typeof mod.register === \"function\") {\n      await mod.register();\n    }\n\n    // Store onRequestError handler on globalThis so environments can reach the\n    // same handler.\n    if (typeof mod.onRequestError === \"function\") {\n      globalThis.__VINEXT_onRequestErrorHandler__ = mod.onRequestError as OnRequestErrorHandler;\n    }\n  } catch (err) {\n    console.error(\n      \"[vinext] Failed to load instrumentation:\",\n      err instanceof Error ? err.message : String(err),\n    );\n  }\n}\n\n/**\n * Report a request error via the instrumentation handler.\n *\n * No-op if no onRequestError handler is registered.\n *\n * Reads the handler from globalThis so this function works correctly regardless\n * of which environment it is called from.\n */\nexport function reportRequestError(\n  error: Error,\n  request: { path: string; method: string; headers: Record<string, string> },\n  context: OnRequestErrorContext,\n): Promise<void> {\n  const handler = getOnRequestErrorHandler();\n  if (!handler) return Promise.resolve();\n\n  const promise = (async () => {\n    try {\n      await handler(error, request, context);\n    } catch (reportErr) {\n      console.error(\n        \"[vinext] onRequestError handler threw:\",\n        reportErr instanceof Error ? reportErr.message : String(reportErr),\n      );\n    }\n  })();\n\n  // On Cloudflare Workers, register with ctx.waitUntil() so the isolate\n  // stays alive until the report completes (e.g. Sentry HTTP request).\n  // On Node.js (dev or vinext start), getRequestExecutionContext() returns\n  // null — fire-and-forget is fine because the process doesn't die.\n  getRequestExecutionContext()?.waitUntil(promise);\n\n  return promise;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,eAAsB,aACpB,QACA,IAE8B;CAE9B,OAAQ,MAAM,OAAO,OAAO,GAAG;;AAGjC,MAAM,4BAA4B,CAAC,IAAI,OAAO;AAE9C,SAAS,4BACP,MACA,UACA,aACe;CACf,KAAK,MAAM,OAAO,2BAChB,KAAK,MAAM,OAAO,YAAY,kBAAkB;EAC9C,MAAM,WAAW,KAAK,KAAK,MAAM,KAAK,GAAG,WAAW,MAAM;EAC1D,IAAI,GAAG,WAAW,SAAS,EACzB,OAAO;;CAIb,OAAO;;;;;AAMT,SAAgB,wBACd,MACA,aACe;CACf,OAAO,4BAA4B,MAAM,mBAAmB,YAAY;;;;;AAM1E,SAAgB,8BACd,MACA,aACe;CACf,OAAO,4BAA4B,MAAM,0BAA0B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