Rocky_Mountain_Vending/.pnpm-store/v10/files/7f/4f552164ad3910da74b9c7730627a68d1482b64f0525d0869fdde1745960426436a61d32ecae5462f6768d200069cb1de024336909f9516e904fcf13cb7f4f
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

1 line
No EOL
48 KiB
Text

{"version":3,"sources":["../../../../src/build/webpack/plugins/middleware-plugin.ts"],"sourcesContent":["import type {\n AssetBinding,\n EdgeMiddlewareMeta,\n} from '../loaders/get-module-build-info'\nimport type { EdgeSSRMeta } from '../loaders/get-module-build-info'\nimport type { ProxyMatcher } from '../../analysis/get-page-static-info'\nimport { getNamedMiddlewareRegex } from '../../../shared/lib/router/utils/route-regex'\nimport { getModuleBuildInfo } from '../loaders/get-module-build-info'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport path from 'path'\nimport {\n EDGE_RUNTIME_WEBPACK,\n EDGE_UNSUPPORTED_NODE_APIS,\n MIDDLEWARE_BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n MIDDLEWARE_MANIFEST,\n MIDDLEWARE_REACT_LOADABLE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n NEXT_FONT_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n} from '../../../shared/lib/constants'\nimport type { ProxyConfig } from '../../analysis/get-page-static-info'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport { traceGlobals } from '../../../trace/shared'\nimport { EVENT_BUILD_FEATURE_USAGE } from '../../../telemetry/events'\nimport { normalizeAppPath } from '../../../shared/lib/router/utils/app-paths'\nimport {\n INSTRUMENTATION_HOOK_FILENAME,\n WEBPACK_LAYERS,\n} from '../../../lib/constants'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites'\nimport { getDynamicCodeEvaluationError } from './wellknown-errors-plugin/parse-dynamic-code-evaluation-error'\nimport { getModuleReferencesInOrder } from '../utils'\n\nconst KNOWN_SAFE_DYNAMIC_PACKAGES =\n require('../../../lib/known-edge-safe-packages.json') as string[]\n\nexport interface EdgeFunctionDefinition {\n files: string[]\n name: string\n page: string\n matchers: ProxyMatcher[]\n env: Record<string, string>\n wasm?: AssetBinding[]\n assets?: AssetBinding[]\n regions?: string[] | string\n}\n\nexport interface MiddlewareManifest {\n version: 3\n sortedMiddleware: string[]\n middleware: { [page: string]: EdgeFunctionDefinition }\n functions: { [page: string]: EdgeFunctionDefinition }\n}\n\ninterface EntryMetadata {\n edgeMiddleware?: EdgeMiddlewareMeta\n edgeApiFunction?: EdgeMiddlewareMeta\n edgeSSR?: EdgeSSRMeta\n wasmBindings: Map<string, string>\n assetBindings: Map<string, string>\n regions?: string[] | string\n}\n\nconst NAME = 'MiddlewarePlugin'\nconst MANIFEST_VERSION = 3\n\n/**\n * Checks the value of usingIndirectEval and when it is a set of modules it\n * check if any of the modules is actually being used. If the value is\n * simply truthy it will return true.\n */\nfunction isUsingIndirectEvalAndUsedByExports(args: {\n module: webpack.Module\n moduleGraph: webpack.ModuleGraph\n runtime: any\n usingIndirectEval: true | Set<string>\n wp: typeof webpack\n}): boolean {\n const { moduleGraph, runtime, module, usingIndirectEval, wp } = args\n if (typeof usingIndirectEval === 'boolean') {\n return usingIndirectEval\n }\n\n const exportsInfo = moduleGraph.getExportsInfo(module)\n for (const exportName of usingIndirectEval) {\n if (exportsInfo.getUsed(exportName, runtime) !== wp.UsageState.Unused) {\n return true\n }\n }\n\n return false\n}\n\nfunction getEntryFiles(\n entryFiles: string[],\n meta: EntryMetadata,\n hasInstrumentationHook: boolean,\n opts: Options\n) {\n const files: string[] = []\n if (meta.edgeSSR) {\n if (meta.edgeSSR.isServerComponent) {\n files.push(`server/${SERVER_REFERENCE_MANIFEST}.js`)\n if (opts.sriEnabled) {\n files.push(`server/${SUBRESOURCE_INTEGRITY_MANIFEST}.js`)\n }\n files.push(\n ...entryFiles\n .filter(\n (file) =>\n file.startsWith('app/') && !file.endsWith('.hot-update.js')\n )\n .map(\n (file) =>\n 'server/' +\n file.replace(/\\.js$/, '_' + CLIENT_REFERENCE_MANIFEST + '.js')\n )\n )\n }\n if (!opts.dev && !meta.edgeSSR.isAppDir) {\n files.push(`server/${DYNAMIC_CSS_MANIFEST}.js`)\n }\n\n files.push(\n `server/${MIDDLEWARE_BUILD_MANIFEST}.js`,\n `server/${MIDDLEWARE_REACT_LOADABLE_MANIFEST}.js`,\n `server/${NEXT_FONT_MANIFEST}.js`,\n `server/${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n }\n\n if (hasInstrumentationHook) {\n files.push(`server/edge-${INSTRUMENTATION_HOOK_FILENAME}.js`)\n }\n\n files.push(\n ...entryFiles\n .filter((file) => !file.endsWith('.hot-update.js'))\n .map((file) => 'server/' + file)\n )\n\n return files\n}\n\nfunction getCreateAssets(params: {\n compilation: webpack.Compilation\n metadataByEntry: Map<string, EntryMetadata>\n opts: Options\n}) {\n const { compilation, metadataByEntry, opts } = params\n return () => {\n const middlewareManifest: MiddlewareManifest = {\n version: MANIFEST_VERSION,\n middleware: {},\n functions: {},\n sortedMiddleware: [],\n }\n\n const hasInstrumentationHook = compilation.entrypoints.has(\n INSTRUMENTATION_HOOK_FILENAME\n )\n\n // we only emit this entry for the edge runtime since it doesn't have access to a routes manifest\n // and we don't need to provide the entire route manifest, just the interception routes.\n const interceptionRewrites = JSON.stringify(\n opts.rewrites.beforeFiles.filter(isInterceptionRouteRewrite)\n )\n compilation.emitAsset(\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`,\n new sources.RawSource(\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )}`\n ) as unknown as webpack.sources.RawSource\n )\n\n for (const entrypoint of compilation.entrypoints.values()) {\n if (!entrypoint.name) {\n continue\n }\n\n // There should always be metadata for the entrypoint.\n const metadata = metadataByEntry.get(entrypoint.name)\n const page =\n metadata?.edgeMiddleware?.page ||\n metadata?.edgeSSR?.page ||\n metadata?.edgeApiFunction?.page\n if (!page) {\n continue\n }\n\n const matcherSource = metadata.edgeSSR?.isAppDir\n ? normalizeAppPath(page)\n : page\n\n const catchAll = !metadata.edgeSSR && !metadata.edgeApiFunction\n\n const { namedRegex } = getNamedMiddlewareRegex(matcherSource, {\n catchAll,\n })\n const matchers = metadata?.edgeMiddleware?.matchers ?? [\n {\n regexp: namedRegex,\n originalSource: page === '/' && catchAll ? '/:path*' : matcherSource,\n },\n ]\n\n const isEdgeFunction = !!(metadata.edgeApiFunction || metadata.edgeSSR)\n const edgeFunctionDefinition: EdgeFunctionDefinition = {\n files: getEntryFiles(\n entrypoint.getFiles(),\n metadata,\n hasInstrumentationHook,\n opts\n ),\n name: entrypoint.name,\n page: page,\n matchers,\n wasm: Array.from(metadata.wasmBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n assets: Array.from(metadata.assetBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n env: opts.edgeEnvironments,\n ...(metadata.regions && { regions: metadata.regions }),\n }\n\n if (isEdgeFunction) {\n middlewareManifest.functions[page] = edgeFunctionDefinition\n } else {\n middlewareManifest.middleware[page] = edgeFunctionDefinition\n }\n }\n\n middlewareManifest.sortedMiddleware = getSortedRoutes(\n Object.keys(middlewareManifest.middleware)\n )\n\n compilation.emitAsset(\n MIDDLEWARE_MANIFEST,\n new sources.RawSource(\n JSON.stringify(middlewareManifest, null, 2)\n ) as unknown as webpack.sources.RawSource\n )\n }\n}\n\nfunction buildWebpackError({\n message,\n loc,\n compilation,\n entryModule,\n parser,\n}: {\n message: string\n loc?: any\n compilation: webpack.Compilation\n entryModule?: webpack.Module\n parser?: webpack.javascript.JavascriptParser\n}) {\n const error = new compilation.compiler.webpack.WebpackError(message)\n error.name = NAME\n const module = entryModule ?? parser?.state.current\n if (module) {\n error.module = module\n }\n error.loc = loc\n return error\n}\n\nfunction isInMiddlewareLayer(parser: webpack.javascript.JavascriptParser) {\n const layer = parser.state.module?.layer\n return layer === WEBPACK_LAYERS.middleware || layer === WEBPACK_LAYERS.apiEdge\n}\n\nfunction isNodeJsModule(moduleName: string) {\n return (require('module') as typeof import('module')).builtinModules.includes(\n moduleName\n )\n}\n\nfunction isBunModule(moduleName: string) {\n return moduleName === 'bun' || moduleName.startsWith('bun:')\n}\n\nfunction isDynamicCodeEvaluationAllowed(\n fileName: string,\n middlewareConfig?: ProxyConfig,\n rootDir?: string\n) {\n // Some packages are known to use `eval` but are safe to use in the Edge\n // Runtime because the dynamic code will never be executed.\n if (\n KNOWN_SAFE_DYNAMIC_PACKAGES.some((pkg) =>\n fileName.includes(`/node_modules/${pkg}/`.replace(/\\//g, path.sep))\n )\n ) {\n return true\n }\n\n const name = fileName.replace(rootDir ?? '', '')\n\n return picomatch(middlewareConfig?.unstable_allowDynamic ?? [], {\n dot: true,\n })(name)\n}\n\nfunction buildUnsupportedApiError({\n apiName,\n loc,\n ...rest\n}: {\n apiName: string\n loc: any\n compilation: webpack.Compilation\n parser: webpack.javascript.JavascriptParser\n}) {\n return buildWebpackError({\n message: `A Node.js API is used (${apiName} at line: ${loc.start.line}) which is not supported in the Edge Runtime.\nLearn more: https://nextjs.org/docs/api-reference/edge-runtime`,\n loc,\n ...rest,\n })\n}\n\nfunction registerUnsupportedApiHooks(\n parser: webpack.javascript.JavascriptParser,\n compilation: webpack.Compilation\n) {\n for (const expression of EDGE_UNSUPPORTED_NODE_APIS) {\n const warnForUnsupportedApi = (node: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: expression,\n ...node,\n })\n )\n return true\n }\n parser.hooks.call.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.expression.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.callMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n parser.hooks.expressionMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n }\n\n const warnForUnsupportedProcessApi = (node: any, [callee]: string[]) => {\n if (!isInMiddlewareLayer(parser) || callee === 'env') {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: `process.${callee}`,\n ...node,\n })\n )\n return true\n }\n\n parser.hooks.callMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n parser.hooks.expressionMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n}\n\nfunction getCodeAnalyzer(params: {\n dev: boolean\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n}) {\n return (parser: webpack.javascript.JavascriptParser) => {\n const {\n dev,\n compiler: { webpack: wp },\n compilation,\n } = params\n const { hooks } = parser\n\n /**\n * For an expression this will check the graph to ensure it is being used\n * by exports. Then it will store in the module buildInfo a boolean to\n * express that it contains dynamic code and, if it is available, the\n * module path that is using it.\n */\n const handleExpression = () => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n wp.optimize.InnerGraph.onUsage(parser.state, (used = true) => {\n const buildInfo = getModuleBuildInfo(parser.state.module)\n if (buildInfo.usingIndirectEval === true || used === false) {\n return\n }\n\n if (!buildInfo.usingIndirectEval || used === true) {\n buildInfo.usingIndirectEval = used\n return\n }\n\n buildInfo.usingIndirectEval = new Set([\n ...Array.from(buildInfo.usingIndirectEval),\n ...Array.from(used),\n ])\n })\n }\n\n /**\n * This expression handler allows to wrap a dynamic code expression with a\n * function call where we can warn about dynamic code not being allowed\n * but actually execute the expression.\n */\n const handleWrapExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_eval__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n return true\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.compile invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n */\n const handleWrapWasmCompileExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_compile__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.instatiate invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n *\n * Note that we don't update `usingIndirectEval`, i.e. we don't abort a production build\n * since we can't determine statically if the first parameter is a module (legit use) or\n * a buffer (dynamic code generation).\n */\n const handleWrapWasmInstantiateExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n if (dev) {\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_instantiate__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n }\n }\n\n /**\n * Handler to store original source location of static and dynamic imports into module's buildInfo.\n */\n const handleImport = (node: any) => {\n if (isInMiddlewareLayer(parser) && node.source?.value && node?.loc) {\n const { module, source } = parser.state\n const buildInfo = getModuleBuildInfo(module)\n if (!buildInfo.importLocByPath) {\n buildInfo.importLocByPath = new Map()\n }\n\n const importedModule = node.source.value?.toString()\n buildInfo.importLocByPath.set(importedModule, {\n sourcePosition: {\n ...node.loc.start,\n source: module.identifier(),\n },\n sourceContent: source.toString(),\n })\n\n if (\n !dev &&\n (isNodeJsModule(importedModule) || isBunModule(importedModule)) &&\n !SUPPORTED_NATIVE_MODULES.includes(importedModule)\n ) {\n const isBun = isBunModule(importedModule)\n compilation.warnings.push(\n buildWebpackError({\n message: `A ${isBun ? 'Bun' : 'Node.js'} module is loaded ('${importedModule}' at line ${node.loc.start.line}) which is not supported in the Edge Runtime.\nLearn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`,\n compilation,\n parser,\n ...node,\n })\n )\n }\n }\n }\n\n /**\n * A noop handler to skip analyzing some cases.\n * Order matters: for it to work, it must be registered first\n */\n const skip = () => (isInMiddlewareLayer(parser) ? true : undefined)\n\n for (const prefix of ['', 'global.']) {\n hooks.expression.for(`${prefix}Function.prototype`).tap(NAME, skip)\n hooks.expression.for(`${prefix}Function.bind`).tap(NAME, skip)\n hooks.call.for(`${prefix}eval`).tap(NAME, handleWrapExpression)\n hooks.call.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.new.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.call\n .for(`${prefix}WebAssembly.compile`)\n .tap(NAME, handleWrapWasmCompileExpression)\n hooks.call\n .for(`${prefix}WebAssembly.instantiate`)\n .tap(NAME, handleWrapWasmInstantiateExpression)\n }\n\n hooks.importCall.tap(NAME, handleImport)\n hooks.import.tap(NAME, handleImport)\n\n if (!dev) {\n // do not issue compilation warning on dev: invoking code will provide details\n registerUnsupportedApiHooks(parser, compilation)\n }\n }\n}\n\nasync function codeAnalyzerBySwc(\n compilation: webpack.Compilation,\n modules: Iterable<webpack.Module>,\n dev: boolean\n) {\n const binding = require('../../swc') as typeof import('../../swc')\n for (const module of modules) {\n if (\n module.layer !== WEBPACK_LAYERS.middleware &&\n module.layer !== WEBPACK_LAYERS.apiEdge\n ) {\n continue\n }\n if (module.constructor.name !== 'NormalModule') {\n continue\n }\n const normalModule = module as webpack.NormalModule\n if (!normalModule.type.startsWith('javascript')) {\n // Only analyze JavaScript modules\n continue\n }\n const originalSource = normalModule.originalSource()\n if (!originalSource) {\n continue\n }\n const source = originalSource.source()\n if (typeof source !== 'string') {\n continue\n }\n const diagnostics = await binding.warnForEdgeRuntime(source, !dev)\n for (const diagnostic of diagnostics) {\n const webpackError = buildWebpackError({\n message: diagnostic.message,\n loc: diagnostic.loc,\n compilation,\n entryModule: module,\n })\n if (diagnostic.severity === 'Warning') {\n compilation.warnings.push(webpackError)\n } else {\n compilation.errors.push(webpackError)\n }\n }\n }\n}\n\nfunction getExtractMetadata(params: {\n compilation: webpack.Compilation\n compiler: webpack.Compiler\n dev: boolean\n metadataByEntry: Map<string, EntryMetadata>\n}): () => Promise<void> {\n const { dev, compilation, metadataByEntry, compiler } = params\n const { webpack: wp } = compiler\n return async () => {\n metadataByEntry.clear()\n const telemetry: Telemetry | undefined = traceGlobals.get('telemetry')\n\n for (const [entryName, entry] of compilation.entries) {\n if (entry.options.runtime !== EDGE_RUNTIME_WEBPACK) {\n // Only process edge runtime entries\n continue\n }\n const entryDependency = entry.dependencies?.[0]\n const resolvedModule =\n compilation.moduleGraph.getResolvedModule(entryDependency)\n if (!resolvedModule) {\n continue\n }\n const { rootDir, route } = getModuleBuildInfo(resolvedModule)\n\n const { moduleGraph } = compilation\n const modules = new Set<webpack.NormalModule>()\n const addEntriesFromDependency = (dependency: any) => {\n const module = moduleGraph.getModule(dependency)\n if (module) {\n modules.add(module as webpack.NormalModule)\n }\n }\n\n entry.dependencies.forEach(addEntriesFromDependency)\n entry.includeDependencies.forEach(addEntriesFromDependency)\n\n const entryMetadata: EntryMetadata = {\n wasmBindings: new Map(),\n assetBindings: new Map(),\n }\n\n if (route?.middlewareConfig?.regions) {\n entryMetadata.regions = route.middlewareConfig.regions\n }\n\n if (route?.preferredRegion) {\n const preferredRegion = route.preferredRegion\n entryMetadata.regions =\n // Ensures preferredRegion is always an array in the manifest.\n typeof preferredRegion === 'string'\n ? [preferredRegion]\n : preferredRegion\n }\n\n let ogImageGenerationCount = 0\n\n for (const module of modules) {\n const buildInfo = getModuleBuildInfo(module)\n\n /**\n * Check if it uses the image generation feature.\n */\n if (!dev) {\n const resource = module.resource\n const hasOGImageGeneration =\n resource &&\n /[\\\\/]node_modules[\\\\/]@vercel[\\\\/]og[\\\\/]dist[\\\\/]index\\.(edge|node)\\.js$|[\\\\/]next[\\\\/]dist[\\\\/](esm[\\\\/])?server[\\\\/]og[\\\\/]image-response\\.js$/.test(\n resource\n )\n\n if (hasOGImageGeneration) {\n ogImageGenerationCount++\n }\n }\n\n /**\n * When building for production checks if the module is using `eval`\n * and in such case produces a compilation error. The module has to\n * be in use.\n */\n if (\n !dev &&\n buildInfo.usingIndirectEval &&\n isUsingIndirectEvalAndUsedByExports({\n module,\n moduleGraph,\n runtime: wp.util.runtime.getEntryRuntime(compilation, entryName),\n usingIndirectEval: buildInfo.usingIndirectEval,\n wp,\n })\n ) {\n const id = module.identifier()\n if (/node_modules[\\\\/]regenerator-runtime[\\\\/]runtime\\.js/.test(id)) {\n continue\n }\n if (route?.middlewareConfig?.unstable_allowDynamic) {\n telemetry?.record({\n eventName: 'NEXT_EDGE_ALLOW_DYNAMIC_USED',\n payload: {\n file: route?.absolutePagePath.replace(rootDir ?? '', ''),\n config: route?.middlewareConfig,\n fileWithDynamicCode: module.userRequest.replace(\n rootDir ?? '',\n ''\n ),\n },\n })\n }\n if (\n !isDynamicCodeEvaluationAllowed(\n module.userRequest,\n route?.middlewareConfig,\n rootDir\n )\n ) {\n const message = `Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime ${\n typeof buildInfo.usingIndirectEval !== 'boolean'\n ? `\\nUsed by ${Array.from(buildInfo.usingIndirectEval).join(\n ', '\n )}`\n : ''\n }\\nLearn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`\n compilation.errors.push(\n getDynamicCodeEvaluationError(\n message,\n module,\n compilation,\n compiler\n )\n )\n }\n }\n\n /**\n * The entry module has to be either a page or a middleware and hold\n * the corresponding metadata.\n */\n if (buildInfo?.nextEdgeSSR) {\n entryMetadata.edgeSSR = buildInfo.nextEdgeSSR\n } else if (buildInfo?.nextEdgeMiddleware) {\n entryMetadata.edgeMiddleware = buildInfo.nextEdgeMiddleware\n } else if (buildInfo?.nextEdgeApiFunction) {\n entryMetadata.edgeApiFunction = buildInfo.nextEdgeApiFunction\n }\n\n /**\n * If the module is a WASM module we read the binding information and\n * append it to the entry wasm bindings.\n */\n if (buildInfo?.nextWasmMiddlewareBinding) {\n entryMetadata.wasmBindings.set(\n buildInfo.nextWasmMiddlewareBinding.name,\n buildInfo.nextWasmMiddlewareBinding.filePath\n )\n }\n\n if (buildInfo?.nextAssetMiddlewareBinding) {\n entryMetadata.assetBindings.set(\n buildInfo.nextAssetMiddlewareBinding.name,\n buildInfo.nextAssetMiddlewareBinding.filePath\n )\n }\n\n /**\n * Append to the list of modules to process outgoingConnections from\n * the module that is being processed.\n */\n for (const conn of getModuleReferencesInOrder(module, moduleGraph)) {\n if (conn.module) {\n modules.add(conn.module as webpack.NormalModule)\n }\n }\n }\n\n telemetry?.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'vercelImageGeneration',\n invocationCount: ogImageGenerationCount,\n },\n })\n metadataByEntry.set(entryName, entryMetadata)\n }\n }\n}\n\n// These values will be replaced again in edge runtime deployment build.\n// `buildId` represents BUILD_ID to be externalized in env vars.\n// `encryptionKey` represents server action encryption key to be externalized in env vars.\ntype EdgeRuntimeEnvironments = Record<string, string> & {\n __NEXT_BUILD_ID: string\n NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: string\n}\n\ninterface Options {\n dev: boolean\n sriEnabled: boolean\n rewrites: CustomRoutes['rewrites']\n edgeEnvironments: EdgeRuntimeEnvironments\n}\n\nexport default class MiddlewarePlugin {\n private readonly dev: Options['dev']\n private readonly sriEnabled: Options['sriEnabled']\n private readonly rewrites: Options['rewrites']\n private readonly edgeEnvironments: EdgeRuntimeEnvironments\n\n constructor({ dev, sriEnabled, rewrites, edgeEnvironments }: Options) {\n this.dev = dev\n this.sriEnabled = sriEnabled\n this.rewrites = rewrites\n this.edgeEnvironments = edgeEnvironments\n }\n\n public apply(compiler: webpack.Compiler) {\n compiler.hooks.compilation.tap(NAME, (compilation, params) => {\n // parser hooks aren't available in rspack\n if (process.env.NEXT_RSPACK) {\n compilation.hooks.finishModules.tapPromise(NAME, async (modules) => {\n await codeAnalyzerBySwc(compilation, modules, this.dev)\n })\n } else {\n const { hooks } = params.normalModuleFactory\n /**\n * This is the static code analysis phase.\n */\n const codeAnalyzer = getCodeAnalyzer({\n dev: this.dev,\n compiler,\n compilation,\n })\n\n hooks.parser.for('javascript/auto').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/dynamic').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/esm').tap(NAME, codeAnalyzer)\n }\n\n /**\n * Extract all metadata for the entry points in a Map object.\n */\n const metadataByEntry = new Map<string, EntryMetadata>()\n compilation.hooks.finishModules.tapPromise(\n NAME,\n getExtractMetadata({\n compilation,\n compiler,\n dev: this.dev,\n metadataByEntry,\n })\n )\n\n /**\n * Emit the middleware manifest.\n */\n compilation.hooks.processAssets.tap(\n {\n name: 'NextJsMiddlewareManifest',\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n getCreateAssets({\n compilation,\n metadataByEntry,\n opts: {\n sriEnabled: this.sriEnabled,\n rewrites: this.rewrites,\n edgeEnvironments: this.edgeEnvironments,\n dev: this.dev,\n },\n })\n )\n })\n }\n}\n\nexport const SUPPORTED_NATIVE_MODULES = [\n 'buffer',\n 'events',\n 'assert',\n 'util',\n 'async_hooks',\n] as const\n\nconst supportedEdgePolyfills = new Set<string>(SUPPORTED_NATIVE_MODULES)\n\nexport function getEdgePolyfilledModules() {\n const records: Record<string, string> = {}\n for (const mod of SUPPORTED_NATIVE_MODULES) {\n records[mod] = `commonjs node:${mod}`\n records[`node:${mod}`] = `commonjs node:${mod}`\n }\n return records\n}\n\nexport async function handleWebpackExternalForEdgeRuntime({\n request,\n context,\n contextInfo,\n getResolve,\n}: {\n request: string\n context: string\n contextInfo: any\n getResolve: () => any\n}) {\n if (\n (contextInfo.issuerLayer === WEBPACK_LAYERS.middleware ||\n contextInfo.issuerLayer === WEBPACK_LAYERS.apiEdge) &&\n (isNodeJsModule(request) || isBunModule(request)) &&\n !supportedEdgePolyfills.has(request)\n ) {\n // allows user to provide and use their polyfills, as we do with buffer.\n try {\n await getResolve()(context, request)\n } catch {\n return `root globalThis.__import_unsupported('${request}')`\n }\n }\n}\n"],"names":["SUPPORTED_NATIVE_MODULES","MiddlewarePlugin","getEdgePolyfilledModules","handleWebpackExternalForEdgeRuntime","KNOWN_SAFE_DYNAMIC_PACKAGES","require","NAME","MANIFEST_VERSION","isUsingIndirectEvalAndUsedByExports","args","moduleGraph","runtime","module","usingIndirectEval","wp","exportsInfo","getExportsInfo","exportName","getUsed","UsageState","Unused","getEntryFiles","entryFiles","meta","hasInstrumentationHook","opts","files","edgeSSR","isServerComponent","push","SERVER_REFERENCE_MANIFEST","sriEnabled","SUBRESOURCE_INTEGRITY_MANIFEST","filter","file","startsWith","endsWith","map","replace","CLIENT_REFERENCE_MANIFEST","dev","isAppDir","DYNAMIC_CSS_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","MIDDLEWARE_REACT_LOADABLE_MANIFEST","NEXT_FONT_MANIFEST","INTERCEPTION_ROUTE_REWRITE_MANIFEST","INSTRUMENTATION_HOOK_FILENAME","getCreateAssets","params","compilation","metadataByEntry","middlewareManifest","version","middleware","functions","sortedMiddleware","entrypoints","has","interceptionRewrites","JSON","stringify","rewrites","beforeFiles","isInterceptionRouteRewrite","emitAsset","sources","RawSource","entrypoint","values","metadata","name","get","page","edgeMiddleware","edgeApiFunction","matcherSource","normalizeAppPath","catchAll","namedRegex","getNamedMiddlewareRegex","matchers","regexp","originalSource","isEdgeFunction","edgeFunctionDefinition","getFiles","wasm","Array","from","wasmBindings","filePath","assets","assetBindings","env","edgeEnvironments","regions","getSortedRoutes","Object","keys","MIDDLEWARE_MANIFEST","buildWebpackError","message","loc","entryModule","parser","error","compiler","webpack","WebpackError","state","current","isInMiddlewareLayer","layer","WEBPACK_LAYERS","apiEdge","isNodeJsModule","moduleName","builtinModules","includes","isBunModule","isDynamicCodeEvaluationAllowed","fileName","middlewareConfig","rootDir","some","pkg","path","sep","picomatch","unstable_allowDynamic","dot","buildUnsupportedApiError","apiName","rest","start","line","registerUnsupportedApiHooks","expression","EDGE_UNSUPPORTED_NODE_APIS","warnForUnsupportedApi","node","warnings","hooks","call","for","tap","callMemberChain","expressionMemberChain","warnForUnsupportedProcessApi","callee","getCodeAnalyzer","handleExpression","optimize","InnerGraph","onUsage","used","buildInfo","getModuleBuildInfo","Set","handleWrapExpression","expr","ConstDependency","dependencies","dep1","range","addPresentationalDependency","dep2","handleWrapWasmCompileExpression","handleWrapWasmInstantiateExpression","handleImport","source","value","importLocByPath","Map","importedModule","toString","set","sourcePosition","identifier","sourceContent","isBun","skip","undefined","prefix","new","importCall","import","codeAnalyzerBySwc","modules","binding","constructor","normalModule","type","diagnostics","warnForEdgeRuntime","diagnostic","webpackError","severity","errors","getExtractMetadata","clear","telemetry","traceGlobals","entryName","entry","entries","route","options","EDGE_RUNTIME_WEBPACK","entryDependency","resolvedModule","getResolvedModule","addEntriesFromDependency","dependency","getModule","add","forEach","includeDependencies","entryMetadata","preferredRegion","ogImageGenerationCount","resource","hasOGImageGeneration","test","util","getEntryRuntime","id","record","eventName","payload","absolutePagePath","config","fileWithDynamicCode","userRequest","join","getDynamicCodeEvaluationError","nextEdgeSSR","nextEdgeMiddleware","nextEdgeApiFunction","nextWasmMiddlewareBinding","nextAssetMiddlewareBinding","conn","getModuleReferencesInOrder","EVENT_BUILD_FEATURE_USAGE","featureName","invocationCount","apply","process","NEXT_RSPACK","finishModules","tapPromise","normalModuleFactory","codeAnalyzer","processAssets","stage","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS","supportedEdgePolyfills","records","mod","request","context","contextInfo","getResolve","issuerLayer"],"mappings":";;;;;;;;;;;;;;;;;IA+3BaA,wBAAwB;eAAxBA;;IAzEb,OAuEC;eAvEoBC;;IAmFLC,wBAAwB;eAAxBA;;IASMC,mCAAmC;eAAnCA;;;4BA54BkB;oCACL;uBACH;yBACC;kEACX;6DACL;2BAaV;wBAGsB;wBACa;0BACT;4BAI1B;oDAEoC;iDACG;wBACH;;;;;;AAE3C,MAAMC,8BACJC,QAAQ;AA6BV,MAAMC,OAAO;AACb,MAAMC,mBAAmB;AAEzB;;;;CAIC,GACD,SAASC,oCAAoCC,IAM5C;IACC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAAA,OAAM,EAAEC,iBAAiB,EAAEC,EAAE,EAAE,GAAGL;IAChE,IAAI,OAAOI,sBAAsB,WAAW;QAC1C,OAAOA;IACT;IAEA,MAAME,cAAcL,YAAYM,cAAc,CAACJ;IAC/C,KAAK,MAAMK,cAAcJ,kBAAmB;QAC1C,IAAIE,YAAYG,OAAO,CAACD,YAAYN,aAAaG,GAAGK,UAAU,CAACC,MAAM,EAAE;YACrE,OAAO;QACT;IACF;IAEA,OAAO;AACT;AAEA,SAASC,cACPC,UAAoB,EACpBC,IAAmB,EACnBC,sBAA+B,EAC/BC,IAAa;IAEb,MAAMC,QAAkB,EAAE;IAC1B,IAAIH,KAAKI,OAAO,EAAE;QAChB,IAAIJ,KAAKI,OAAO,CAACC,iBAAiB,EAAE;YAClCF,MAAMG,IAAI,CAAC,CAAC,OAAO,EAAEC,oCAAyB,CAAC,GAAG,CAAC;YACnD,IAAIL,KAAKM,UAAU,EAAE;gBACnBL,MAAMG,IAAI,CAAC,CAAC,OAAO,EAAEG,yCA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