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>
1 line
No EOL
5.4 KiB
Text
1 line
No EOL
5.4 KiB
Text
{"version":3,"sources":["../../../src/server/app-render/action-utils.ts"],"sourcesContent":["import type { ActionManifest } from '../../build/webpack/plugins/flight-client-entry-plugin'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { pathHasPrefix } from '../../shared/lib/router/utils/path-has-prefix'\nimport { removePathPrefix } from '../../shared/lib/router/utils/remove-path-prefix'\nimport { workAsyncStorage } from './work-async-storage.external'\n\n// This function creates a Flight-acceptable server module map proxy from our\n// Server Reference Manifest similar to our client module map.\n// This is because our manifest contains a lot of internal Next.js data that\n// are relevant to the runtime, workers, etc. that React doesn't need to know.\nexport function createServerModuleMap({\n serverActionsManifest,\n}: {\n serverActionsManifest: ActionManifest\n}) {\n return new Proxy(\n {},\n {\n get: (_, id: string) => {\n const workers =\n serverActionsManifest[\n process.env.NEXT_RUNTIME === 'edge' ? 'edge' : 'node'\n ]?.[id]?.workers\n\n if (!workers) {\n return undefined\n }\n\n const workStore = workAsyncStorage.getStore()\n\n let workerEntry:\n | { moduleId: string | number; async: boolean }\n | undefined\n\n if (workStore) {\n workerEntry = workers[normalizeWorkerPageName(workStore.page)]\n } else {\n // If there's no work store defined, we can assume that a server\n // module map is needed during module evaluation, e.g. to create a\n // server action using a higher-order function. Therefore it should be\n // safe to return any entry from the manifest that matches the action\n // ID. They all refer to the same module ID, which must also exist in\n // the current page bundle. TODO: This is currently not guaranteed in\n // Turbopack, and needs to be fixed.\n workerEntry = Object.values(workers).at(0)\n }\n\n if (!workerEntry) {\n return undefined\n }\n\n const { moduleId, async } = workerEntry\n\n return { id: moduleId, name: id, chunks: [], async }\n },\n }\n )\n}\n\n/**\n * Checks if the requested action has a worker for the current page.\n * If not, it returns the first worker that has a handler for the action.\n */\nexport function selectWorkerForForwarding(\n actionId: string,\n pageName: string,\n serverActionsManifest: ActionManifest\n) {\n const workers =\n serverActionsManifest[\n process.env.NEXT_RUNTIME === 'edge' ? 'edge' : 'node'\n ][actionId]?.workers\n const workerName = normalizeWorkerPageName(pageName)\n\n // no workers, nothing to forward to\n if (!workers) return\n\n // if there is a worker for this page, no need to forward it.\n if (workers[workerName]) {\n return\n }\n\n // otherwise, grab the first worker that has a handler for this action id\n return denormalizeWorkerPageName(Object.keys(workers)[0])\n}\n\n/**\n * The flight entry loader keys actions by bundlePath.\n * bundlePath corresponds with the relative path (including 'app') to the page entrypoint.\n */\nfunction normalizeWorkerPageName(pageName: string) {\n if (pathHasPrefix(pageName, 'app')) {\n return pageName\n }\n\n return 'app' + pageName\n}\n\n/**\n * Converts a bundlePath (relative path to the entrypoint) to a routable page name\n */\nfunction denormalizeWorkerPageName(bundlePath: string) {\n return normalizeAppPath(removePathPrefix(bundlePath, 'app'))\n}\n"],"names":["normalizeAppPath","pathHasPrefix","removePathPrefix","workAsyncStorage","createServerModuleMap","serverActionsManifest","Proxy","get","_","id","workers","process","env","NEXT_RUNTIME","undefined","workStore","getStore","workerEntry","normalizeWorkerPageName","page","Object","values","at","moduleId","async","name","chunks","selectWorkerForForwarding","actionId","pageName","workerName","denormalizeWorkerPageName","keys","bundlePath"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,0CAAyC;AAC1E,SAASC,aAAa,QAAQ,gDAA+C;AAC7E,SAASC,gBAAgB,QAAQ,mDAAkD;AACnF,SAASC,gBAAgB,QAAQ,gCAA+B;AAEhE,6EAA6E;AAC7E,8DAA8D;AAC9D,4EAA4E;AAC5E,8EAA8E;AAC9E,OAAO,SAASC,sBAAsB,EACpCC,qBAAqB,EAGtB;IACC,OAAO,IAAIC,MACT,CAAC,GACD;QACEC,KAAK,CAACC,GAAGC;gBAELJ,4BAAAA;YADF,MAAMK,WACJL,0BAAAA,qBAAqB,CACnBM,QAAQC,GAAG,CAACC,YAAY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