Duffer Derek

Current Path : /var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/next/dist/esm/server/
Upload File :
Current File : /var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/next/dist/esm/server/load-components.js.map

{"version":3,"sources":["../../../src/server/load-components.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'node:http'\nimport type {\n  AppType,\n  DocumentType,\n  NextComponentType,\n} from '../shared/lib/utils'\nimport type { ClientReferenceManifest } from '../build/webpack/plugins/flight-manifest-plugin'\nimport type {\n  PageConfig,\n  GetStaticPaths,\n  GetServerSideProps,\n  GetStaticProps,\n} from '../types'\nimport type { RouteModule } from './route-modules/route-module'\nimport type { BuildManifest } from './get-page-files'\nimport type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'\n\nimport {\n  BUILD_MANIFEST,\n  REACT_LOADABLE_MANIFEST,\n  CLIENT_REFERENCE_MANIFEST,\n  SERVER_REFERENCE_MANIFEST,\n  DYNAMIC_CSS_MANIFEST,\n  SUBRESOURCE_INTEGRITY_MANIFEST,\n} from '../shared/lib/constants'\nimport { join } from 'path'\nimport { requirePage } from './require'\nimport { interopDefault } from '../lib/interop-default'\nimport { getTracer } from './lib/trace/tracer'\nimport { LoadComponentsSpan } from './lib/trace/constants'\nimport { evalManifest, loadManifest } from './load-manifest.external'\nimport { wait } from '../lib/wait'\nimport { setManifestsSingleton } from './app-render/manifests-singleton'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { isStaticMetadataRoute } from '../lib/metadata/is-metadata-route'\n\nexport type ManifestItem = {\n  id: number | string\n  files: string[]\n}\n\nexport type ReactLoadableManifest = { [moduleId: string]: ManifestItem }\n/**\n * This manifest prevents removing server rendered <link> tags after client\n * navigation. This is only needed under `Pages dir && Production && Webpack`.\n * @see https://github.com/vercel/next.js/pull/72959\n */\nexport type DynamicCssManifest = string[]\n\n/**\n * A manifest entry type for the react-loadable-manifest.json.\n *\n * The whole manifest.json is a type of `Record<pathname, LoadableManifest>`\n * where pathname is a string-based key points to the path of the page contains\n * each dynamic imports.\n */\nexport interface LoadableManifest {\n  [k: string]: { id: string | number; files: string[] }\n}\n\nexport type GenericComponentMod = {\n  handler(\n    req: IncomingMessage,\n    res: ServerResponse,\n    ctx: {\n      waitUntil?: (prom: Promise<void>) => void\n    }\n  ): Promise<void | null>\n}\n\nexport type LoadComponentsReturnType<\n  NextModule extends GenericComponentMod = GenericComponentMod,\n> = {\n  Component: NextComponentType\n  pageConfig: PageConfig\n  buildManifest: DeepReadonly<BuildManifest>\n  subresourceIntegrityManifest?: DeepReadonly<Record<string, string>>\n  reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n  dynamicCssManifest?: DeepReadonly<DynamicCssManifest>\n  Document: DocumentType\n  App: AppType\n  getStaticProps?: GetStaticProps\n  getStaticPaths?: GetStaticPaths\n  getServerSideProps?: GetServerSideProps\n  ComponentMod: NextModule\n  routeModule: RouteModule\n  isAppPath?: boolean\n  page: string\n  multiZoneDraftMode?: boolean\n}\n\n/**\n * Load manifest file with retries, defaults to 3 attempts.\n */\nexport async function loadManifestWithRetries<T extends object>(\n  manifestPath: string,\n  attempts = 3\n) {\n  while (true) {\n    try {\n      return loadManifest<T>(manifestPath)\n    } catch (err) {\n      attempts--\n      if (attempts <= 0) throw err\n\n      await wait(100)\n    }\n  }\n}\n\n/**\n * Load manifest file with retries, defaults to 3 attempts, or return undefined.\n */\nexport async function tryLoadManifestWithRetries<T extends object>(\n  manifestPath: string,\n  attempts = 3\n) {\n  try {\n    return await loadManifestWithRetries<T>(manifestPath, attempts)\n  } catch (err) {\n    return undefined\n  }\n}\n\n/**\n * Load manifest file with retries, defaults to 3 attempts.\n */\nexport async function evalManifestWithRetries<T extends object>(\n  manifestPath: string,\n  attempts = 3\n) {\n  while (true) {\n    try {\n      return evalManifest<T>(manifestPath)\n    } catch (err) {\n      attempts--\n      if (attempts <= 0) throw err\n\n      await wait(100)\n    }\n  }\n}\n\nasync function tryLoadClientReferenceManifest(\n  manifestPath: string,\n  entryName: string,\n  attempts?: number\n): Promise<DeepReadonly<ClientReferenceManifest> | undefined> {\n  try {\n    const context = await evalManifestWithRetries<{\n      __RSC_MANIFEST: { [key: string]: ClientReferenceManifest }\n    }>(manifestPath, attempts)\n    return context.__RSC_MANIFEST[entryName]\n  } catch (err) {\n    return undefined\n  }\n}\n\nasync function loadComponentsImpl<\n  N extends GenericComponentMod = GenericComponentMod,\n>({\n  distDir,\n  page,\n  isAppPath,\n  isDev,\n  sriEnabled,\n  // When route modules are used, which is the case for the server calls to loadComponents, it no longer needs manifest to be loaded here.\n  // Static generation still needs the manifests to be loaded here.\n  // In the future static generation will also use route modules, and we will remove this flag.\n  needsManifestsForLegacyReasons,\n}: {\n  distDir: string\n  page: string\n  isAppPath: boolean\n  isDev: boolean\n  sriEnabled: boolean\n  needsManifestsForLegacyReasons: boolean\n}): Promise<LoadComponentsReturnType<N>> {\n  let DocumentMod = {}\n  let AppMod = {}\n  if (!isAppPath) {\n    ;[DocumentMod, AppMod] = await Promise.all([\n      requirePage('/_document', distDir, false),\n      requirePage('/_app', distDir, false),\n    ])\n  }\n\n  if (needsManifestsForLegacyReasons) {\n    // In dev mode we retry loading a manifest file to handle a race condition\n    // that can occur while app and pages are compiling at the same time, and the\n    // build-manifest is still being written to disk while an app path is\n    // attempting to load.\n    const manifestLoadAttempts = isDev ? 3 : 1\n\n    let reactLoadableManifestPath: string\n    if (!process.env.TURBOPACK) {\n      reactLoadableManifestPath = join(\n        /* turbopackIgnore: true */ distDir,\n        REACT_LOADABLE_MANIFEST\n      )\n    } else if (isAppPath) {\n      reactLoadableManifestPath = join(\n        /* turbopackIgnore: true */ distDir,\n        'server',\n        'app',\n        page,\n        REACT_LOADABLE_MANIFEST\n      )\n    } else {\n      reactLoadableManifestPath = join(\n        /* turbopackIgnore: true */ distDir,\n        'server',\n        'pages',\n        normalizePagePath(page),\n        REACT_LOADABLE_MANIFEST\n      )\n    }\n\n    // Make sure to avoid loading the manifest for static metadata routes for better performance.\n    const hasClientManifest = !isStaticMetadataRoute(page)\n\n    // Load the manifest files first\n    //\n    // Loading page-specific manifests shouldn't throw an error if the manifest couldn't be found, so\n    // that the `requirePage` call below will throw the correct error in that case\n    // (a `PageNotFoundError`).\n    const [\n      buildManifest,\n      reactLoadableManifest,\n      dynamicCssManifest,\n      clientReferenceManifest,\n      serverActionsManifest,\n      subresourceIntegrityManifest,\n    ] = await Promise.all([\n      loadManifestWithRetries<BuildManifest>(\n        join(/* turbopackIgnore: true */ distDir, BUILD_MANIFEST),\n        manifestLoadAttempts\n      ),\n      tryLoadManifestWithRetries<ReactLoadableManifest>(\n        reactLoadableManifestPath,\n        manifestLoadAttempts\n      ),\n      // This manifest will only exist in Pages dir && Production && Webpack.\n      isAppPath || process.env.TURBOPACK\n        ? undefined\n        : loadManifestWithRetries<DynamicCssManifest>(\n            join(\n              /* turbopackIgnore: true */ distDir,\n              `${DYNAMIC_CSS_MANIFEST}.json`\n            ),\n            manifestLoadAttempts\n          ).catch(() => undefined),\n      isAppPath && hasClientManifest\n        ? tryLoadClientReferenceManifest(\n            join(\n              /* turbopackIgnore: true */ distDir,\n              'server',\n              'app',\n              page.replace(/%5F/g, '_') +\n                '_' +\n                CLIENT_REFERENCE_MANIFEST +\n                '.js'\n            ),\n            page.replace(/%5F/g, '_'),\n            manifestLoadAttempts\n          )\n        : undefined,\n      isAppPath\n        ? loadManifestWithRetries<ActionManifest>(\n            join(\n              /* turbopackIgnore: true */ distDir,\n              'server',\n              SERVER_REFERENCE_MANIFEST + '.json'\n            ),\n            manifestLoadAttempts\n          ).catch(() => null)\n        : null,\n      sriEnabled\n        ? loadManifestWithRetries<DeepReadonly<Record<string, string>>>(\n            join(\n              /* turbopackIgnore: true */ distDir,\n              'server',\n              SUBRESOURCE_INTEGRITY_MANIFEST + '.json'\n            )\n          ).catch(() => undefined)\n        : undefined,\n    ])\n\n    // Before requiring the actual page module, we have to set the reference\n    // manifests to our global store so Server Action's encryption util can access\n    // to them at the top level of the page module.\n    if (serverActionsManifest && clientReferenceManifest) {\n      setManifestsSingleton({\n        page,\n        clientReferenceManifest,\n        serverActionsManifest,\n      })\n    }\n\n    const ComponentMod = await requirePage(page, distDir, isAppPath)\n\n    const Component = interopDefault(ComponentMod)\n    const Document = interopDefault(DocumentMod)\n    const App = interopDefault(AppMod)\n\n    const { getServerSideProps, getStaticProps, getStaticPaths, routeModule } =\n      ComponentMod\n\n    return {\n      // @ts-expect-error this is indeed `{} || AppType` and not always `AppType`\n      App,\n      // @ts-expect-error this is indeed `{} || DocumentType` and not always `DocumentType`\n      Document,\n      Component,\n      buildManifest,\n      subresourceIntegrityManifest,\n      reactLoadableManifest: reactLoadableManifest || {},\n      dynamicCssManifest,\n      pageConfig: ComponentMod.config || {},\n      ComponentMod,\n      getServerSideProps,\n      getStaticProps,\n      getStaticPaths,\n      isAppPath,\n      page,\n      routeModule,\n    }\n  } else {\n    const ComponentMod = await requirePage(page, distDir, isAppPath)\n\n    const Component = interopDefault(ComponentMod)\n    const Document = interopDefault(DocumentMod)\n    const App = interopDefault(AppMod)\n\n    const { getServerSideProps, getStaticProps, getStaticPaths, routeModule } =\n      ComponentMod\n\n    return {\n      App,\n      Document,\n      Component,\n      pageConfig: ComponentMod.config || {},\n      ComponentMod,\n      getServerSideProps,\n      getStaticProps,\n      getStaticPaths,\n      isAppPath,\n      page,\n      routeModule,\n    } as any // temporary `as any` to make TypeScript not fail so that the tests will run on the PR.\n  }\n}\n\nexport const loadComponents = getTracer().wrap(\n  LoadComponentsSpan.loadComponents,\n  loadComponentsImpl\n)\n"],"names":["BUILD_MANIFEST","REACT_LOADABLE_MANIFEST","CLIENT_REFERENCE_MANIFEST","SERVER_REFERENCE_MANIFEST","DYNAMIC_CSS_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","join","requirePage","interopDefault","getTracer","LoadComponentsSpan","evalManifest","loadManifest","wait","setManifestsSingleton","normalizePagePath","isStaticMetadataRoute","loadManifestWithRetries","manifestPath","attempts","err","tryLoadManifestWithRetries","undefined","evalManifestWithRetries","tryLoadClientReferenceManifest","entryName","context","__RSC_MANIFEST","loadComponentsImpl","distDir","page","isAppPath","isDev","sriEnabled","needsManifestsForLegacyReasons","DocumentMod","AppMod","Promise","all","manifestLoadAttempts","reactLoadableManifestPath","process","env","TURBOPACK","hasClientManifest","buildManifest","reactLoadableManifest","dynamicCssManifest","clientReferenceManifest","serverActionsManifest","subresourceIntegrityManifest","catch","replace","ComponentMod","Component","Document","App","getServerSideProps","getStaticProps","getStaticPaths","routeModule","pageConfig","config","loadComponents","wrap"],"mappings":"AAiBA,SACEA,cAAc,EACdC,uBAAuB,EACvBC,yBAAyB,EACzBC,yBAAyB,EACzBC,oBAAoB,EACpBC,8BAA8B,QACzB,0BAAyB;AAChC,SAASC,IAAI,QAAQ,OAAM;AAC3B,SAASC,WAAW,QAAQ,YAAW;AACvC,SAASC,cAAc,QAAQ,yBAAwB;AACvD,SAASC,SAAS,QAAQ,qBAAoB;AAC9C,SAASC,kBAAkB,QAAQ,wBAAuB;AAC1D,SAASC,YAAY,EAAEC,YAAY,QAAQ,2BAA0B;AACrE,SAASC,IAAI,QAAQ,cAAa;AAClC,SAASC,qBAAqB,QAAQ,mCAAkC;AAExE,SAASC,iBAAiB,QAAQ,8CAA6C;AAC/E,SAASC,qBAAqB,QAAQ,oCAAmC;AAyDzE;;CAEC,GACD,OAAO,eAAeC,wBACpBC,YAAoB,EACpBC,WAAW,CAAC;IAEZ,MAAO,KAAM;QACX,IAAI;YACF,OAAOP,aAAgBM;QACzB,EAAE,OAAOE,KAAK;YACZD;YACA,IAAIA,YAAY,GAAG,MAAMC;YAEzB,MAAMP,KAAK;QACb;IACF;AACF;AAEA;;CAEC,GACD,OAAO,eAAeQ,2BACpBH,YAAoB,EACpBC,WAAW,CAAC;IAEZ,IAAI;QACF,OAAO,MAAMF,wBAA2BC,cAAcC;IACxD,EAAE,OAAOC,KAAK;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F;YACrFD;YACAD;YACAT;YACAK;YACAJ,uBAAuBA,yBAAyB,CAAC;YACjDC;YACAc,YAAYR,aAAaS,MAAM,IAAI,CAAC;YACpCT;YACAI;YACAC;YACAC;YACA5B;YACAD;YACA8B;QACF;IACF,OAAO;QACL,MAAMP,eAAe,MAAM9C,YAAYuB,MAAMD,SAASE;QAEtD,MAAMuB,YAAY9C,eAAe6C;QACjC,MAAME,WAAW/C,eAAe2B;QAChC,MAAMqB,MAAMhD,eAAe4B;QAE3B,MAAM,EAAEqB,kBAAkB,EAAEC,cAAc,EAAEC,cAAc,EAAEC,WAAW,EAAE,GACvEP;QAEF,OAAO;YACLG;YACAD;YACAD;YACAO,YAAYR,aAAaS,MAAM,IAAI,CAAC;YACpCT;YACAI;YACAC;YACAC;YACA5B;YACAD;YACA8B;QACF,GAAS,uFAAuF;IAClG;AACF;AAEA,OAAO,MAAMG,iBAAiBtD,YAAYuD,IAAI,CAC5CtD,mBAAmBqD,cAAc,EACjCnC,oBACD","ignoreList":[0]}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists